Zero-downtime deployment

Deployment slots and health-aware routing.

Advanced25 min · lesson 12 of 15

Zero-downtime deployment is an expectation for modern services, and Azure provides concrete mechanisms to achieve it. Deployment slots and health-aware deployment are the tools that let you ship without interrupting users.

Deployment slots

App Service deployment slots are separate, live instances of your app (like a staging slot) that share the same App Service plan. You deploy the new version to the staging slot, warm it up and run smoke tests against it while production traffic still flows to the current slot, then swap the slots — the staging slot becomes production instantly with no downtime, and if something is wrong you swap back for an immediate rollback. The swap is a routing change, not a redeploy, so it is fast and reversible. Slots also let you validate a release in a production-identical environment before it takes traffic, catching configuration issues that only appear in the real environment. This is the simplest path to zero-downtime, instantly-reversible deployments for web apps on Azure.

zero-downtime slot swap
# 1. Deploy the new version to the STAGING slot (production keeps serving).
az webapp deploy -g app-rg -n contoso-web --slot staging --src-path app.zip
# 2. Warm it + smoke-test against the staging slot's URL.
# 3. Swap → staging becomes production instantly (a routing change, no downtime).
az webapp deployment slot swap -g app-rg -n contoso-web --slot staging
# 4. Problem? Swap back → instant rollback to the previous version.

Health-aware deployment

Zero-downtime also depends on the platform routing traffic only to healthy instances. Health checks (App Service health check, load balancer probes, Kubernetes readiness/liveness probes) ensure that a new instance receives traffic only once it reports ready, and an unhealthy instance is taken out of rotation — so a bad deployment does not serve errors. Combined with slots (or blue/green and rolling updates on AKS), health-aware deployment means the service stays available throughout a release. For containers, the same principles apply through AKS rolling updates with readiness probes. The DevOps engineer wires these together — slots or rolling strategy, health checks, warm-up, and automated rollback — so deployments are routine, invisible to users, and safely reversible, which is what lets a team deploy frequently without fear of disrupting the service.

Zero-downtime deployment
1deploy to staging slot
prod keeps serving
2warm + smoke test
validate before traffic
3swap (routing change)
instant, no downtime
4health checks route traffic
only to ready instances
Slots plus health checks give zero-downtime, instantly-reversible deployments — swap to release, swap back to roll back.
Swapping without warming up serves cold-start errors
If you swap a staging slot into production before the app is warmed up, the first users hit a cold instance — slow responses or errors — undermining the zero-downtime goal. Warm the staging slot and run smoke tests before swapping, and use health checks so traffic only routes to instances that report ready.