Sahih Muslim 1840
Sahih Muslim · Book 33: The Book on Government · The obligation of obeying leaders in matters that do not involve sin, but it is forbidden to obey them in sinful matters
وَ حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ ، حَدَّثَنَا وَكِيعٌ، وَأَبُو مُعَاوِيَةَ عَنِ الأَعْمَشِ، بِهَذَا الإِسْنَادِ نَحْوَهُ .
This hadith has been transmitted on the authority of A'mash.