كتاب الإمارة
33  
The Book on Government
(18)
Chapter: It is recommended for the army to swear allegiance to the ruler when intending to fight, and an account of Bay'at Ar-Ridwan beneath the tree
(18)
باب اسْتِحْبَابِ مُبَايَعَةِ الإِمَامِ الْجَيْشَ عِنْدَ إِرَادَةِ الْقِتَالِ وَبَيَانِ بَيْعَةِ الرِّضْوَانِ تَحْتَ الشَّجَرَةِ
Sahih Muslim 1858 b

This hadith has been narrated on the authority of Yunus with the same chain of transmitters.

وَحَدَّثَنَاهُ يَحْيَى بْنُ يَحْيَى، أَخْبَرَنَا خَالِدُ بْنُ عَبْدِ اللَّهِ، عَنْ يُونُسَ، بِهَذَا الإِسْنَادِ.
Reference : Sahih Muslim 1858b
In-book reference : Book 33, Hadith 115
USC-MSA web (English) reference : Book 20, Hadith 4587
  (deprecated numbering scheme)