Sunan an-Nasa'i 4205
It was narrated from Abu 'Adur-Rahman from Ali that:
the Messenger of Allah  sent an army and appointed a man in charge of them. He lit a fire and said: "Enter it." Some people wanted to enter it, and other said: "We are trying to keep away from it." They mentioned that to the Messenger of Allah, and he said to those who had wanted to enter if: "If you had entered it you would have stayed there until the Day of Resurrection." And he spoke good words to the others. And he said: "There is no obedience if it involves disobedience toward Allah. Rather obedience is only (required) in that which is good."
أَخْبَرَنَا مُحَمَّدُ بْنُ الْمُثَنَّى، وَمُحَمَّدُ بْنُ بَشَّارٍ، قَالاَ حَدَّثَنَا مُحَمَّدٌ، قَالَ حَدَّثَنَا شُعْبَةُ، عَنْ زُبَيْدٍ الإِيَامِيِّ، عَنْ سَعْدِ بْنِ عُبَيْدَةَ، عَنْ أَبِي عَبْدِ الرَّحْمَنِ، عَنْ عَلِيٍّ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم بَعَثَ جَيْشًا وَأَمَّرَ عَلَيْهِمْ رَجُلاً فَأَوْقَدَ نَارًا فَقَالَ ادْخُلُوهَا ‏.‏ فَأَرَادَ نَاسٌ أَنْ يَدْخُلُوهَا وَقَالَ الآخَرُونَ إِنَّمَا فَرَرْنَا مِنْهَا ‏.‏ فَذَكَرُوا ذَلِكَ لِرَسُولِ اللَّهِ صلى الله عليه وسلم فَقَالَ لِلَّذِينَ أَرَادُوا أَنْ يَدْخُلُوهَا ‏"‏ لَوْ دَخَلْتُمُوهَا لَمْ تَزَالُوا فِيهَا إِلَى يَوْمِ الْقِيَامَةِ ‏"‏ ‏.‏ وَقَالَ لِلآخَرِينَ خَيْرًا ‏.‏ وَقَالَ أَبُو مُوسَى فِي حَدِيثِهِ قَوْلاً حَسَنًا ‏.‏ وَقَالَ ‏"‏ لاَ طَاعَةَ فِي مَعْصِيَةِ اللَّهِ إِنَّمَا الطَّاعَةُ فِي الْمَعْرُوفِ ‏"‏ ‏.‏