Skip to main content

Deployment Slot

A deployment slot is a separate live instance of an App Service app, such as staging, that shares the production app's plan. You can swap it with production for near-zero-downtime releases and quick rollback.

Deployment Slot

Each slot has its own host name, settings, and content. You deploy the new version to staging, let it warm up, test it, then swap. A swap is a routing change between two already-running instances, not a redeploy, so a bad release can be swapped back in seconds. Slots need the Standard tier or higher and run on the same plan, so there is no duplicate infrastructure to pay for.

How Does a Slot Swap Work?

sequenceDiagram participant D as Pipeline participant S as Staging slot participant P as Production slot D->>S: Deploy new version D->>S: Warm up and smoke test D->>P: Swap with staging P-->>D: Old version now in staging

How Do You Swap Slots?

Bash
az webapp deployment slot create --name mumbai-api \
--resource-group mumbai-prod-rg --slot staging
az webapp deployment slot swap --name mumbai-api \
--resource-group mumbai-prod-rg --slot staging --target-slot production

Why It Matters in Production

A fintech team like PhonePe's can deploy each release to staging, run smoke tests, and swap only after health checks pass. If error rates rise, swapping again restores the previous version almost instantly.

Common Mistake

Forgetting slot settings. App settings and connection strings swap with the code unless you mark them as deployment slot settings, so a swap can point production at a staging database.

Tip

Use swap with preview to apply production settings to staging and verify the app before completing the swap.

Frequently Asked Questions

Do deployment slots cost extra?

No separate charge. Slots run on the same App Service Plan, but they use that plan's CPU and memory, so heavy testing in a slot can affect production.

What does a swap actually do?

It exchanges the routing between two running instances after warming up the source slot. Content is not copied, which is why it is fast and reversible.

Which tiers support slots?

Standard, Premium, and Isolated tiers. Free, Shared, and Basic do not, and the number of slots allowed rises with the tier.

Found a mistake, an outdated step or a broken link?