Musnad Ahmad 1018
It was narrated that ‘Ali (رضي الله عنه) said:
The Prophet (ﷺ) sent out an expedition and appointed over them a man of the Ansar, and commanded them to listen to him and obey. They made him angry about something, so he said: Gather firewood for me. So they gathered firewood, then he said: Light a fire. So they lit a fire, then he said: Didn`t the Messenger of Allah (ﷺ) command you to listen to me and obey? They said: Yes indeed. He said: Then enter it (the fire). They looked at one another and said: We only fled to the Messenger of Allah (ﷺ) because of the Fire. They continued talking until his anger dissipated and the fire went out. When they came to the Prophet (ﷺ) they told him about that and he said: “If they had entered it they would never have come out of it, obedience is only in that which is right and proper.`
حَدَّثَنَا وَكِيعٌ، حَدَّثَنَا الْأَعْمَشُ، عَنْ سَعْدِ بْنِ عُبَيْدَةَ، عَنْ أَبِي عَبْدِ الرَّحْمَنِ السُّلَمِيِّ، عَنْ عَلِيٍّ، رَضِيَ اللَّهُ عَنْهُ قَالَ بَعَثَ النَّبِيُّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ سَرِيَّةً وَأَمَّرَ عَلَيْهِمْ رَجُلًا مِنْ الْأَنْصَارِ وَأَمَرَهُمْ أَنْ يَسْمَعُوا لَهُ وَيُطِيعُوا قَالَ فَأَغْضَبُوهُ فِي شَيْءٍ فَقَالَ اجْمَعُوا لِي حَطَبًا فَجَمَعُوا حَطَبًا ثُمَّ قَالَ أَوْقِدُوا نَارًا فَأَوْقَدُوا لَهُ نَارًا فَقَالَ أَلَمْ يَأْمُرْكُمْ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ أَنْ تَسْمَعُوا لِي وَتُطِيعُوا قَالُوا بَلَى قَالَ فَادْخُلُوهَا قَالَ فَنَظَرَ بَعْضُهُمْ إِلَى بَعْضٍ فَقَالُوا إِنَّمَا فَرَرْنَا إِلَى رَسُولِ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ مِنْ أَجْلِ النَّارِ فَكَانُوا كَذَلِكَ إِذْ سَكَنَ غَضَبُهُ وَطَفِئَتْ النَّارُ قَالَ فَلَمَّا قَدِمُوا عَلَى النَّبِيِّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ ذَكَرُوا ذَلِكَ لَهُ فَقَالَ لَوْ دَخَلُوهَا مَا خَرَجُوا مِنْهَا إِنَّمَا الطَّاعَةُ فِي الْمَعْرُوفِ‏.‏