A blast from the past —
Cyrus Vance was Secretary of State under Jimmy Carter at the time of the Iran hostage crisis. When Carter ordered a secret military rescue, Vance resigned in opposition. Vance felt the rescue attempt was too risky, and did not even wait to see its failure before announcing his resignation
That’s what you do if you’re principled. You tell the president what you really think, and if the president’s policies really diverge, you step down.
Or you can be spineless about it.
It is, though Vance is the last I recall. I believe he resigned publically after the mission was over.