Sahih Muslim Book 020, Hadith Number 4528.
Chapter : Obedience to the ruler is forbidden in matters sinful, but is otherwise obligatory.
It has been narrated on the authority of Yahya b. Husain who learnt the tradition from his grandmother. She said that she heard the Holy Prophet (may peace be upon him) delivering his sermon on the occasion of the Last Pilgrimage. He was saying: If a slave is appointed over you and he conducts your affairs according to the Book of Allah, you should listen to him and obey (his orders).