Releasing Safely with Deployment Slots
This lesson explains deployment slots, how swaps work, and which settings swap or stay with a slot.
Learning outcomes
After completing this lesson, you will be able to:
- Describe deployment slots and their tier requirements.
- Explain the steps of a swap and how to roll back.
- Distinguish between settings that swap and settings that stay with a slot.
What a slot is
A deployment slot is a live app with its own host name, such as contoso-staging.azurewebsites.net, its own content and its own configuration, running on the same App Service plan instances as the production slot. Slots are available in Standard (up to 5 slots), Premium (up to 20) and Isolated tiers. A new slot can clone the configuration of production or another slot, but not its content.
Slot basics
How a swap works
A swap exchanges the source slot (for example staging) with the target slot (usually production) in a way that avoids cold starts. The steps below describe what App Service does.
-
Apply target settings
The target slot's sticky settings (slot settings) are applied to all instances of the source slot, which restarts them.
-
Warm up
App Service waits for every source instance to restart and sends warm-up requests (to the root or the paths in applicationInitialization).
-
Switch routing
When all instances are warm, the routing rules are swapped, so the target slot now serves the new version.
-
Update the old version
The previous production content, now in the source slot, receives the source's settings.
Because the old version remains in the staging slot, swapping again rolls back. Swap with preview (multi-phase swap) stops after the first step so that the source can be validated with production settings before the swap is completed or cancelled. Auto swap swaps a slot into production automatically after each deployment to it.
What a swap does
Sticky and swapped settings
By default, most configuration moves with the content during a swap: general settings, app settings and connection strings that are not marked as slot settings, handler mappings, public certificates, WebJobs content and hybrid connections. Settings that should stay with a slot, such as a staging database connection string, are marked Deployment slot setting on the Environment variables page. Some settings are never swapped: publishing endpoints, custom domain names, non-public certificates and TLS/SSL bindings, scale settings, WebJobs schedulers, IP restrictions, Always On, diagnostic settings, CORS, VNet integration, managed identities and settings ending in _EXTENSION_VERSION.
Traffic routing on the Deployment slots page sends a percentage of production traffic to another slot, for testing in production; users are pinned to the slot with a cookie.
The following diagram shows deployment slot settings, traffic routing and a swap that keep each slot's own database connection.

Swapped or stays with the slot?
Safe releases
A web app on a Premium v3 plan uses a production database. A staging slot must test new releases against a test database, and after the swap, production must still use the production database. The team also wants to send 5% of users to the new version before swapping. What should you configure?
Create the connection string in each slot with its own database and mark it as a deployment slot setting in both, so it stays with the slot during swaps. Deploy to staging, set traffic routing to send 5% of production traffic to staging, and then swap. Without the slot setting, the swap would move the test database connection string into production.
Do custom domain bindings move during a slot swap?
Show answer
No. Custom domains and TLS bindings always stay with their slot.
Exam Tips
Remember for the exam
- Slots: Standard up to 5, Premium up to 20; they share the plan's instances.
- A swap warms up the source before switching; swap again to roll back.
- Mark slot-specific values as deployment slot settings.
- Custom domains, TLS bindings, scale settings and managed identities never swap.