Understanding Azure App Service deployment slots

Posted: (EET/GMT+2)

 

Azure App Service deployment slots are one of those features that you don't fully appreciate until you start using them. If you deploy a web app regularly, slots can help you reduce downtime, improve confidence and even test configuration changes without affecting users.

A deployment slot is essentially a second (or third, fourth...) running instance of your web application. You deploy your code to the slot, verify that everything works, and then swap it with production when you're ready.

Key benefits of deployment slots in Azure web application can be summarized as:

  • Zero downtime deployments: swaps are instant and user traffic is not interrupted.
  • Safe testing: you can test your app with production-like configuration before going live.
  • Configuration differences: connection strings and settings can differ between slots.

Microsoft already has a good documentation about this, but here's the basic workflow:

  1. Create a "staging" slot.
  2. Deploy your app to the staging slot.
  3. Test the staging slot (URL looks like: https://mysite-staging.azurewebsites.net).
  4. When ready, perform a "Swap" in the Azure Portal or via Azure CLI.

Swapping slots also swaps the environment variables, connection strings and many configuration settings, which makes this much safer than deploying directly to production.

If you haven't tried deployment slots yet, they are one of the easiest ways to make your Azure deployments more robust. They work for .NET, Node.js, Java, Python and other stack types.