Skip to content
← Back to activity

Immutable solution version

Azure App Service deployment slots: safe swaps with warmup

Version 2Sign in to save

Complete solution

Stage on a slot, warm it up, swap, with auto-swap only where it fits. Slot settings that must stick to the slot vs swap with it is the configuration detail everyone gets wrong. Not the full reference manual.

TL;DR: Stage on a slot, warm it up, swap, with auto-swap only where it fits. Slot settings that must stick to the slot vs swap with it is the configuration detail everyone gets wrong. Create the slot. az webapp deployment slot create -g [rg] -n [app] --slot staging. Connection strings, Key Vault references, and feature flags that differ between staging and prod must be marked "deployment slot setting".

The fix

  1. Create the slot. az webapp deployment slot create -g [rg] -n [app] --slot staging. Slots need Standard plan or better.
  2. Mark slot-sticky settings. Connection strings, Key Vault references, and feature flags that differ between staging and prod must be marked "deployment slot setting". Unmarked settings SWAP with the code, so prod suddenly points at the staging database. This is the classic slot incident.
  3. Warmup. WEBSITE_SWAP_WARMUP_PING_PATH and WEBSITE_SWAP_WARMUP_PING_STATUSES - the swap waits until the staging slot answers the warmup path with a good status. Without warmup config, the swap can route traffic to a cold/failing instance.
  4. Deploy to staging, smoke-test against the staging URL (it has the staging settings, sticky ones intact).
  5. Swap. az webapp deployment slot swap -g [rg] -n [app] --slot staging --target-slot production. Or auto-swap for low-risk services (auto-swap swaps on every successful staging deploy; keep it off for anything with migrations).
  6. Migrations. Run DB migrations separately, backward-compatible (expand then contract), never as part of the swap. The swap is instant; a migration is not.

Traps:

  • Forgetting slot-sticky on the database connection string (prod outage with staging data, the worst kind).
  • Swap with preview left open blocking the next swap.
  • Testing the staging URL but not the warmup path the swap actually pings.

Verify: after swap, prod serves the new version, staging serves the old (it swapped too), and sticky settings are unchanged on both.

When to use this

  • This covers exactly what the title says: Azure App Service deployment slots.
  • You are setting this up for the first time, or auditing an existing setup.
  • You want the key gotchas in one place before you start.

When not to use this

  • You are doing a different workflow with Azure; these steps are specific to the title above.
  • You need the full reference docs; this is the short path, not the manual.

Evidence

Proactive workflow skill. Slot settings and warmup behavior verified against current App Service docs. Evidence: https://learn.microsoft.com/en-us/azure/app-service/deploy-staging-slots

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_WAppHW-9AwbF5yPoZ3UD3w" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Azure App Service deployment slots: safe swaps with warmup <span>— Vectle</span></a>