Share via

If swapping a web app slot fails, it doesn't revert the changes to variables that it's already made

Scott Walker 0 Reputation points
2026-03-25T09:36:13.13+00:00

Second time this has happened for us. If a slot swap fails, it doesn't revert any changes it's already made to the slot specific variables

We use azure/CLI@v2 Github Action to swap our slot. Specifically with this inline script:

inlineScript: az webapp deployment slot swap -g group -n api --slot staging --target-slot production

If this fails for whatever reason, then it doesn't revert the changes that it's already made. It upgrades Staging to Production and changes any slot specific variables (In this case "environment"). When it fails, it doesn't revert that variable back to staging, so we end up with Staging environment pointing to Production resources.

Azure App Service
Azure App Service

Azure App Service is a service used to create and deploy scalable, mission-critical web apps.


1 answer

Sort by: Most helpful
  1. Yutaka_K_JP 1,650 Reputation points
    2026-03-26T12:52:04.9533333+00:00

    I think the swap slips cuz the lower sync‑layer writes its diff first and leaves the slot kinda half‑moved… so i just save the appsettings before the swap and drop them back with set if staging drifts and if even that won’t stick, a fresh slot is the only clean way out.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.