Note that this command is commonly viewed to be contingent on the authority's noninterference with your obedience to God's commands. If the authority is requiring something from you that God forbids or forbidding something that God demands, you are obliged to either leave the situation or take action against the corrupt authority or both. This counsel comes from principle, but it also comes from a familiar situation in the Book of Daniel:
4 “You shall not make for yourself an idol, or any likeness of what is in heaven above or on the earth beneath, or in the water under the earth. 5 You shall not worship them nor serve them; for I, the Lord your God, am a jealous God, inflicting the punishment of the fathers on the children, on the third and the fourth generations of those who hate Me,
13 Then Nebuchadnezzar in rage and anger gave orders to bring Shadrach, Meshach, and Abed-nego; then these men were brought before the king. 14 Nebuchadnezzar began speaking and said to them, “Is it true, Shadrach, Meshach, and Abed-nego, that you do not serve my gods, nor worship the golden statue that I have set up? 15 Now if you are ready, at the moment you hear the sound of the horn, flute, lyre, trigon, psaltery and bagpipe, and all kinds of musical instruments, to fall down and worship the statue that I have made, very well. But if you do not worship, you will immediately be thrown into the midst of a furnace of blazing fire; and what god is there who can rescue you from my hands?”
16 Shadrach, Meshach, and Abed-nego replied to the king, “Nebuchadnezzar, we are not in need of an answer to give you concerning this matter. 17 If it be so, our God whom we serve is able to rescue us from the furnace of blazing fire; and He will rescue us from your hand, O king. 18 But even if He does not, let it be known to you, O king, that we are not going to serve your gods nor worship the golden statue that you have set up.”
19 Then Nebuchadnezzar was filled with wrath, and his facial expression was changed toward Shadrach, Meshach, and Abed-nego. He answered by giving orders to heat the furnace seven times more than it was usually heated. 20 And he ordered certain valiant warriors who were in his army to tie up Shadrach, Meshach, and Abed-nego in order to throw them into the furnace of blazing fire. 21 Then these men were tied up in their trousers, their coats, their caps, and their other clothes, and were thrown into the middle of the furnace of blazing fire. 22 For this reason, because the king’s command was harsh and the furnace had been made extremely hot, the flame of the fire killed those men who took up Shadrach, Meshach, and Abed-nego. 23 But these three men, Shadrach, Meshach, and Abed-nego, fell into the middle of the furnace of blazing fire still tied up.
24 Then Nebuchadnezzar the king was astounded and stood up quickly; he said to his counselors, “Was it not three men that we threw bound into the middle of the fire?” They replied to the king, “Absolutely, O king.” 25 He responded, “Look! I see four men untied and walking about in the middle of the fire unharmed, and the appearance of the fourth is like a son of the gods!” 26 Then Nebuchadnezzar came near to the door of the furnace of blazing fire; he said, “Shadrach, Meshach, and Abed-nego, come out, you servants of the Most High God, and come here!” Then Shadrach, Meshach, and Abed-nego came out of the middle of the fire. 27 The satraps, the prefects, the governors, and the king’s counselors gathered together and saw that the fire had no effect on the bodies of these men, nor was the hair of their heads singed, nor were their trousers damaged, nor had even the smell of fire touched them.
God was faithful to rescue Shadrach, Meshach, and Abed-nego from corrupt and evil authority that wanted them to worship idols. Nowhere is their resolve rebuked - their resolve to follow God in the face of evil authority wasn't contingent on his rescue.