Web App Service field-manual-complete field-manual-complete field-manual-complete

Deployment slot swap

A deployment slot swap is the App Service release move that trades the roles of two slots, usually staging and production. Instead of deploying directly over the live app, teams deploy to a staging slot, test it, warm it up, and then swap it into production. The old production version remains in the other slot, which gives a fast rollback path. The swap is powerful, but settings, secrets, connection strings, and warm-up behavior must be understood before using it.

Aliases
App Service slot swap, swap deployment slots, staging to production swap, Azure slot promotion
Difficulty
intermediate
CLI mappings
5
Last verified
2026-05-31

Microsoft Learn

Microsoft Learn describes App Service deployment slots as live apps with their own host names. A slot swap exchanges a source slot with a target slot, commonly staging into production, after settings, warm-up behavior, routing, and slot-specific configuration are reviewed.

Microsoft Learn: Set up staging environments in Azure App Service2026-05-31

Technical context

Technically, a slot swap belongs to Azure App Service deployment architecture. Each slot is a live app sharing the App Service Plan but holding its own hostname, content, configuration, and slot-specific settings. During swap, App Service applies swap behavior to move traffic and configuration between source and target. Some settings are sticky to a slot, while others move with the app. The operation interacts with custom domains, TLS, application settings, managed identity, health checks, deployment pipelines, and activity logs.

Why it matters

Deployment slot swap matters because production releases fail most often at the boundary between validated code and real traffic. Slots let teams test the deployed artifact in App Service before users see it, then promote it quickly with less downtime than direct deployment. A bad swap can still cause outages if slot settings are wrong, staging points to production databases unexpectedly, warm-up is incomplete, or sticky settings are misunderstood. Used well, swaps create a disciplined release and rollback pattern that auditors, operators, and developers can all reason about during stressful incidents. That shared pattern reduces panic when production behavior changes unexpectedly.

Where you see it

Signals, screens, and Azure surfaces where this term usually becomes operational.

Signal 01

In the App Service portal, deployment slot swap appears on the Deployment slots page with source slot, target slot, preview options, configuration, and warnings before release.

Signal 02

In Azure CLI output, slot commands list available slots, app settings, and swap execution details that release pipelines can store as evidence. The same output should be archived with health checks and approval records.

Signal 03

In activity logs and deployment pipelines, slot swaps appear as production-changing operations with timestamp, caller, app name, source slot, target slot, and approval evidence during review.

When this becomes relevant

Specific situations where this term helps solve real Azure design, operations, migration, security, reliability, cost, or governance problems.

  • Promote a validated staging build into production with less downtime than direct deployment over the live app.
  • Roll back quickly by swapping the previous production build back after a bad App Service release.
  • Warm up a .NET, Java, Node.js, or containerized web app before sending real production traffic.
  • Use swap with preview to validate configuration behavior before completing a high-risk production promotion.
  • Keep production secrets and connection strings sticky while moving tested application content through the release flow.

Real-world case studies

Different enterprise-style examples that show the term being used to hit measurable objectives.

Case study 01

Airline booking release with warm-up validation

Scenario, objectives, solution, measured impact, and takeaway.

Scenario

A regional airline’s booking portal needed a pricing-engine update during a travel sale without repeating a previous direct deployment that caused checkout errors.

Business/Technical Objectives
  • Validate the deployed build under App Service before production traffic moved.
  • Keep a rollback path available for the previous booking version.
  • Protect production connection strings and payment settings during promotion.
  • Reduce release-related checkout errors during sale launch.
Solution Using Deployment slot swap

The release team deployed the new booking build to a staging slot and marked payment gateway credentials, production database strings, and feature flags as slot settings where appropriate. The staging slot ran warm-up checks against pricing, seat inventory, and login dependencies. Azure CLI listed slots and app settings before the approved swap, then the pipeline executed the staging-to-production swap after health checks passed. The previous production build remained in the staging slot for immediate rollback. Application Insights alerts watched checkout failures, dependency latency, and conversion rate for thirty minutes after promotion.

Results & Business Impact
  • Checkout error rate during the sale launch stayed below 0.4%, compared with 3.1% during the prior direct deployment.
  • Rollback readiness time fell from 25 minutes to under 3 minutes because the old build stayed in the alternate slot.
  • No production secrets moved into staging after sticky settings were reviewed before swap.
  • The pricing update shipped inside the approved fifteen-minute change window.
Key Takeaway for Glossary Readers

Deployment slot swaps let App Service teams promote warmed, validated builds while keeping rollback close at hand.

Case study 02

Insurance portal rollback after a document bug

Scenario, objectives, solution, measured impact, and takeaway.

Scenario

An insurance carrier released a claims portal update that passed staging tests but generated malformed PDF letters for a subset of customers after production promotion.

Business/Technical Objectives
  • Roll back the web release before customer-service queues spiked.
  • Preserve evidence of the failed release for developers.
  • Avoid changing database state during rollback.
  • Create a safer release checklist for document-generation changes.
Solution Using Deployment slot swap

The operations lead used the documented deployment slot swap rollback command to move the previous production version back within minutes. Because feature flags and connection strings were slot-specific, rollback did not redirect the portal to staging dependencies. Application Insights snapshots, activity logs, and App Service logs from the failed production window were exported before cleanup. Developers reproduced the PDF defect in the staging slot while customers used the restored production build. The release checklist was updated to include sample PDF validation, background job checks, and slot-setting review before future swaps.

Results & Business Impact
  • Customer-visible PDF errors lasted 11 minutes instead of the estimated two-hour redeploy path.
  • Call-center volume rose only 6% during the incident, below the 25% escalation threshold.
  • Developers retained logs and failed documents needed to fix the template bug the same day.
  • The next claims release completed with zero rollback actions after new validation checks were added.
Key Takeaway for Glossary Readers

A slot swap is valuable not just for promotion, but for fast rollback when a real production defect appears.

Case study 03

Media site traffic cutover for a festival launch

Scenario, objectives, solution, measured impact, and takeaway.

Scenario

A public broadcaster expected a traffic surge for a festival microsite and wanted to update the homepage without cold starts or content-cache surprises.

Business/Technical Objectives
  • Warm the new App Service version before festival traffic arrived.
  • Avoid duplicate scheduled jobs from staging during the content cutover.
  • Confirm custom domain and TLS behavior after promotion.
  • Keep editors productive during the launch window.
Solution Using Deployment slot swap

The web team deployed the new microsite build to a staging slot one day before launch. Scheduled content-refresh jobs were disabled in staging to prevent duplicate publishing, while health probes loaded the homepage, video index, and API dependencies. Operators tailed staging logs, checked memory and CPU on the shared App Service Plan, and verified sticky settings for storage keys and editorial API endpoints. At the release window, Azure CLI performed the slot swap and the CDN was purged after production health checks passed. Editors used the prior production build in the alternate slot only as a rollback option.

Results & Business Impact
  • Homepage p95 response time stayed under 350 milliseconds during a 5.1x traffic spike.
  • No duplicate publishing jobs ran because staging job settings were reviewed before swap.
  • TLS and custom domain checks passed within two minutes of promotion.
  • Editors avoided the planned one-hour content freeze and published eight festival updates during launch.
Key Takeaway for Glossary Readers

Slot swaps support high-traffic content launches when warm-up, sticky settings, and background jobs are treated as release-critical details.

Why use Azure CLI for this?

I use Azure CLI for deployment slot swaps because release operations need repeatable evidence, not just a button press. CLI lets me list slots, inspect sticky settings, check health endpoints, run a swap from a pipeline, and capture who swapped what during a release. It also makes rollback fast when seconds matter. After years of App Service support, I want the exact source slot, target slot, app name, resource group, and timestamp in deployment logs. That record is far better than remembering which portal blade someone clicked. It also removes ambiguity when multiple teams share release responsibility. when rollback pressure rises.

CLI use cases

  • List deployment slots and confirm the intended source and target before a release starts.
  • Inspect app settings and slot-setting stickiness so production secrets do not move unexpectedly.
  • Trigger a slot swap from a pipeline after health checks and approval gates pass.
  • Roll back by swapping the prior production slot back after monitoring detects a release regression.
  • Capture activity and command output as release evidence for incident reviews and change-control records.

Before you run CLI

  • Confirm the app name, resource group, source slot, target slot, and active subscription before running a swap command.
  • Review sticky app settings, connection strings, identities, Key Vault references, custom domains, and access restrictions for both slots.
  • Validate health checks, logs, dependency connectivity, and warm-up behavior in the staging slot before production traffic moves.
  • Make sure database migrations and feature flags are backward compatible enough for rollback if the swapped version misbehaves.

What output tells you

  • Slot lists confirm which named environments exist and whether the intended staging slot is available for promotion.
  • App setting output shows which values are marked slot-specific and should remain tied to their current slot.
  • Swap command completion indicates that App Service accepted the production-changing operation, but monitoring still proves success.
  • Activity log records identify the caller, timestamp, source slot, and target slot for audit and incident timelines.

Mapped Azure CLI commands

Deployment slot swap CLI commands

direct
az webapp deployment slot list --name <app-name> --resource-group <resource-group> --output table
az webapp deployment slotdiscoverWeb
az webapp config appsettings list --name <app-name> --resource-group <resource-group> --slot <slot-name>
az webapp config appsettingsdiscoverWeb
az webapp deployment slot swap --name <app-name> --resource-group <resource-group> --slot <source-slot> --target-slot production
az webapp deployment slotoperateWeb
az webapp log tail --name <app-name> --resource-group <resource-group> --slot <slot-name>
az webapp logdiscoverWeb
az webapp show --name <app-name> --resource-group <resource-group> --query state
az webappdiscoverWeb

Architecture context

Architecturally, deployment slot swap is a release-safety pattern for App Service workloads. I use it when the app can run side by side with production, when configuration is well separated, and when the team has a health check that proves the staging slot is ready. It belongs with CI/CD, rollback design, database migration strategy, and observability. The most important design choice is which settings stick to the slot: production secrets, connection strings, feature flags, and custom domains must not surprise the app after promotion. Slot swap reduces release risk only when the surrounding architecture is disciplined. Without that discipline, a swap can simply move risk faster.

Security

Security depends on how slot settings, identities, secrets, and exposure are handled. A staging slot may still be reachable through its hostname, so authentication, access restrictions, and test data rules matter. Slot-specific settings should keep production secrets tied to production when appropriate, while source code and packages move through the swap. Managed identities, Key Vault references, connection strings, and CORS settings must be reviewed before promotion. Operators should limit who can perform swaps because the action effectively changes production. Activity logs and pipeline approvals should record every swap and rollback. Staging is still a real endpoint and deserves real controls.

Cost

Slot swaps affect cost indirectly through App Service Plan capacity and release operations. Deployment slots run on the same plan, so staging traffic and warm-up can consume CPU, memory, connections, and outbound calls that production also needs. Higher tiers may be required to use the number of slots or capacity a release process expects. Slots can reduce outage and rollback cost, but idle staging slots, duplicate background jobs, and noisy logging can add waste. FinOps should verify which slots are always on, which jobs run there, and whether nonproduction slots can be scaled or stopped safely. Slots should earn their spend through safer releases or faster recovery.

Reliability

Reliability is the main reason to use slot swaps. They reduce direct deployment risk by giving the app a staging runtime for validation and warm-up before production traffic moves. Reliability still depends on health checks, sticky settings, database compatibility, dependency readiness, and rollback testing. If a migration is not backward compatible, swapping code quickly will not save the release. Good teams rehearse swaps, keep the previous production version in the alternate slot, use swap with preview where appropriate, and monitor errors, latency, and dependency failures immediately after promotion. Rollback must be practiced before the first severe release incident. under real release pressure.

Performance

Performance benefits come from warming and validating the app before users hit it. A staging slot can load assemblies, initialize caches, test database connections, and prove health endpoints before the swap. However, performance can degrade if warm-up is shallow, staging uses different settings, or both slots compete for the same App Service Plan resources. Operators should measure cold start, memory, CPU, p95 latency, dependency latency, and error rate before and after the swap. If the app depends on slot-specific cache or local storage behavior, test that explicitly. Warm-up checks should prove the user path, not just process start. before customer traffic arrives.

Operations

Operations teams use slot swaps during planned releases, emergency rollback, blue-green validation, and incident review. The runbook should list slots, current traffic target, app settings that are sticky, custom domain and TLS expectations, health-check URL, deployment package, and rollback command. Before swapping, operators validate staging logs, dependency connectivity, and warm-up. After swapping, they watch App Service metrics, Application Insights failures, dependency calls, and activity logs. The key operational habit is to treat swap as a production change with evidence before and after, not a casual deployment shortcut. Every swap should leave evidence that another operator can follow. during every production change.

Common mistakes

  • Forgetting to mark production-only connection strings or secrets as slot settings before swapping staging into production.
  • Running background jobs in both production and staging slots, causing duplicate processing during warm-up or after rollback.
  • Skipping health checks and assuming a successful deployment to staging means the app is ready for production traffic.
  • Using slots with database migrations that cannot tolerate old and new code running during rollback.
  • Swapping the wrong slot because app names and staging slots are similar across resource groups or subscriptions.