Skip to main content

Deploying Zero-Downtime Releases with App Service Deployment Slots

Learn to use App Service Deployment Slots to test a new release on a live URL before swapping it into production with zero downtime.

Overview and What You Will Learn

In this lab, you will create a staging slot for an App Service, deploy a new version of an application to it while production keeps serving live traffic unaffected, verify the new version works correctly, then swap it into production - and see how quickly that swap can be reversed if something goes wrong.

Why This Matters in Production

A team at Swiggy deploys a new release directly to their single production App Service, discovers a bug affecting live orders within minutes, and has to scramble to redeploy the previous version while customers are actively affected. Deployment Slots let that same team test the new release on its own live URL first, with production completely untouched, and make the actual cutover an operation that can be undone in seconds if needed.

Core Principles

A Deployment Slot is a fully separate, live instance of an App Service, with its own distinct URL, sharing the same underlying App Service Plan as production.

◈ DIAGRAM
+------------------------------------------+
| Staging Slot (its own live URL) |
| New version deployed and tested here first |
+------------------------------------------+
|
| SWAP (near-instant,
| reversible)
v
+------------------------------------------+
| Production Slot (the real, customer-facing|
| URL) |
+------------------------------------------+

A swap exchanges which slot is considered production - the new version becomes live, and the previous production version now sits in the staging slot, ready to be swapped back instantly if the new release causes a problem.

Detailed Step-by-Step Practical Lab

  1. Create a Resource Group, App Service Plan, and web app:
Bash
az group create --name rg-slots-lab-mumbai --location centralindia
az appservice plan create \
--name asp-slots-lab \
--resource-group rg-slots-lab-mumbai \
--sku S1 \
--is-linux
az webapp create \
--resource-group rg-slots-lab-mumbai \
--plan asp-slots-lab \
--name inventory-app-rahul \
--runtime "NODE:20-lts"
Note

Deployment Slots require a Standard tier (S1) or higher App Service Plan - the Free and Shared tiers do not support this feature.

  1. Create a staging slot:
Bash
az webapp deployment slot create \
--name inventory-app-rahul \
--resource-group rg-slots-lab-mumbai \
--slot staging
  1. Deploy a new version of the application specifically to the staging slot, leaving production entirely untouched:
Bash
az webapp deployment source config-zip \
--resource-group rg-slots-lab-mumbai \
--name inventory-app-rahul \
--slot staging \
--src ./inventory-app-v2.zip
  1. Visit the staging slot's own distinct URL to test the new version live, without affecting production traffic at all:
Bash
curl https://inventory-app-rahul-staging.azurewebsites.net
  1. Once verified, swap the staging slot into production:
Bash
az webapp deployment slot swap \
--name inventory-app-rahul \
--resource-group rg-slots-lab-mumbai \
--slot staging \
--target-slot production
  1. Confirm the new version is now live on the main production URL:
Bash
curl https://inventory-app-rahul.azurewebsites.net
  1. If a problem is discovered after the swap, reverse it immediately by swapping back:
Bash
az webapp deployment slot swap \
--name inventory-app-rahul \
--resource-group rg-slots-lab-mumbai \
--slot production \
--target-slot staging
  1. Clean up:
Bash
az group delete --name rg-slots-lab-mumbai --yes --no-wait

Production Best Practices & Common Pitfalls

Common Mistake

Deploying new code directly to the production slot with no staging step at all, then discovering a critical bug only after customers are already affected. A staging slot costs nothing extra beyond the existing App Service Plan and gives you a real, live testing environment before any customer sees the new version.

Tip

A slot swap is nearly instantaneous and immediately reversible - this makes it one of the lowest-risk ways to deploy, since a bad release can be undone in seconds rather than requiring a full redeploy of the previous version from source control.

  • Slot-specific settings stay with the slot during a swap, not with the code. Configure settings like connection strings correctly per slot before swapping, since a setting marked as "slot-specific" will not move to production during the swap - it stays behind in whichever slot it was originally set on.
  • Warm up the staging slot before swapping by sending it a few real requests first, so the application's cold-start initialization has already happened before it becomes production traffic.

Quick Reference & Troubleshooting Commands

Command Description
az webapp deployment slot create Create a new deployment slot
az webapp deployment slot swap Swap two slots, promoting one to production
az webapp deployment slot list List all slots for a web app
az webapp deployment source config-zip Deploy a zip package to a specific slot

Explore More in Azure Compute Services

All 6 Topics

Frequently Asked Questions

Is Deploying Zero-Downtime Releases with App Service Deployment Slots free to learn on DevOps Network?

Yes - this topic, like everything on DevOps Network, is 100% free with no paywall or sign-up gate.

What does the Deploying Zero-Downtime Releases with App Service Deployment Slots topic cover?

Learn to use App Service Deployment Slots to test a new release on a live URL before swapping it into production with zero downtime.