Study guide
9.2 Minimizing Downtime: Deployment Slots & Rolling Updates
Microsoft Certified: Azure DevOps Engineer Expert AZ-400
Track your progress as you read
Finished sections get a check mark.
1 Chapter 1: Flow of Work, Traceability & Work Tracking
1.1 Flow of Work, GitHub Flow & Feedback Cycles 1.2 Work Tracking with Azure Boards & GitHub Projects 1.3 End-to-End DevOps Traceability & Quality Tracking
2 Chapter 2: DevOps Metrics, Dashboards & Team Collaboration
2.1 DORA Metrics, Flow Metrics & Dashboard Design 2.2 Lifecycle Metrics Across the Six DevOps Phases 2.3 Work Item Queries, WIQL Charts & Analytics 2.4 Project Documentation: Wikis, Mermaid Diagrams & Release Notes 2.5 Webhooks, Service Hooks & Microsoft Teams ChatOps
3 Chapter 3: Git Branching Strategies & Pull Request Workflows
3.1 Git Branching Models & Strategy Design 3.2 Pull Request Workflows & Merge Strategies 3.3 Branch Policies, Quality Gates & Compliance Restrictions
4 Chapter 4: Repository Management, Optimization & Git Data Operations
4.1 Git LFS Architecture & .gitattributes Tracking 4.2 LFS History Migration, git-fat & File Locking 4.3 Git Repository Scaling, Scalar & Monorepo Governance 4.4 Repository Permissions & Git Tag Governance 4.5 Git Data Recovery & Sensitive-Data Scrubbing
5 Chapter 5: Package Management & Dependency Versioning
5.1 Selecting Package Tools: Azure Artifacts vs. GitHub Packages 5.2 Feed Scoping, Upstream Sources & Pipeline Authentication 5.3 Package Views, Immutability & Quality Promotion 5.4 Dependency Versioning: SemVer, CalVer & Automated Versioning 5.5 Pipeline Artifact Versioning & Artifact Storage Strategy
6 Chapter 6: Pipeline Infrastructure, Agents & Integration
6.1 Selecting a CI/CD Solution: Azure Pipelines vs. GitHub Actions 6.2 GitHub-Azure Pipelines Integration & Hybrid Migration 6.3 Hosted vs. Self-Hosted Agents & Runners 6.4 VMSS Elastic Pools, Container Jobs & Agent Governance 6.5 Pipeline Triggers, Filters & Concurrency Management
7 Chapter 7: YAML Pipeline Architecture & Reusable Elements
7.1 YAML Pipeline Anatomy: Stages, Jobs, Steps & Workspaces 7.2 Job Execution Order: DAG Dependencies, Parallelism & Conditions 7.3 Reusable Elements: Templates, Parameters & Variables 7.4 Variable Groups, Secret Variables & Key Vault Linking 7.5 YAML Environments, Checks & Deployment Approvals
8 Chapter 8: Testing Strategy, Quality Gates & Code Coverage
8.1 Test Strategy Design: Local, Unit & Integration Testing 8.2 Load, Stress & Performance Testing in Pipelines 8.3 Test Execution Tasks, Agents & Results Integration 8.4 Code Coverage Analysis & SonarQube Integration 8.5 Quality Gates, Release Gates & Governance Checks
9 Chapter 9: Modern Deployment Strategies & Zero-Downtime Delivery
9.1 Progressive Delivery: Blue-Green, Canary & Ring Deployments 9.2 Minimizing Downtime: Deployment Slots & Rolling Updates 9.3 Feature Flags with Azure App Configuration & Feature Manager 9.4 Designing the High-Priority Hotfix Path 9.5 Ordered Dependency Deployments, Resiliency & Rollback
10 Chapter 10: Artifact Deployment & Database DevOps
10.1 Containerized Application Delivery: ACR, AKS & Container Apps 10.2 Binary, Web App, Function & Scripted Deployments 10.3 Database DevOps: State-Based & Migration-Based Strategies
11 Chapter 11: Infrastructure as Code (IaC) & Azure Deployment Environments
11.1 Infrastructure as Code Strategy: Bicep, ARM & Terraform 11.2 Desired State Configuration & Azure Machine Configuration 11.3 Azure Deployment Environments (ADE) & Developer Self-Service
12 Chapter 12: Pipeline Maintenance, Health & Modernization
12.1 Pipeline Health, Flaky Tests & Reliability Engineering 12.2 Pipeline Optimization: Caching, Slicing & Concurrency 12.3 Artifact & Build Retention Governance 12.4 Modernizing CI/CD: Classic to YAML Migration
13 Chapter 13: Authentication, Authorization & Identity Governance
13.1 Microsoft Entra Service Principals & Managed Identities 13.2 Service Connections, Workload Identity & Personal Access Tokens 13.3 Azure DevOps Projects, Teams & Permission Evaluation 13.4 Access Levels, GitHub Roles & Outside Collaborators
14 Chapter 14: Secrets Management, Sensitive Data & DevSecOps Scanning
14.1 Azure Key Vault, Secret Variables & Secretless CI/CD 14.2 Security Scanning Strategy, GHAS & Secret Scanning 14.3 CodeQL SAST in Pipelines and Containers 14.4 Software Supply Chain, Container Scanning & Cloud Defender
15 Chapter 15: Telemetry Collection, Azure Monitor & Alerting
15.1 Azure Monitor Architecture, AMA & Data Collection Rules 15.2 Application Insights & Specialized Azure Monitor Insights 15.3 Alerting Rules, Action Groups & GitHub Repository Insights
16 Chapter 16: Telemetry Analysis, Distributed Tracing & SRE Practices
16.1 Distributed Tracing, Application Map & Exception Triage 16.2 KQL Log Analytics, SRE Observability & Error Budgets
9.2 Minimizing Downtime: Deployment Slots & Rolling Updates
Key Takeaways Explain This Topic AI
Azure App Service deployment slots provide isolated live web environments with dedicated hostnames, enabling pre-production validation in real cloud infrastructure before traffic cutover.
Slot swap operations execute an instantaneous virtual IP and routing rule swap at the Azure load balancing fabric rather than moving files or restarting compute workers.
Application warmup mitigates cold-start latency during slot swaps through applicationInitialization in web.config and custom health probe ping paths.
Slot settings must be deliberately separated into sticky settings (which remain pinned to the slot, such as database connection strings) and unpinned settings (which swap with code).
Rolling deployments in Virtual Machine Scale Sets and Azure Kubernetes Service (AKS) maintain operational capacity by bounding updates with maxSurge and maxUnavailable constraints.
Last updated: September 2026
9.2 Minimizing Downtime: Deployment Slots & Rolling Updates
Eliminating deployment downtime requires orchestration mechanisms at the infrastructure and application hosting layers that smoothly transition active workloads. In Microsoft Azure, two primary technologies govern zero-downtime execution across PaaS, IaaS, and CaaS workloads: Azure App Service Deployment Slots and Rolling Updates in Virtual Machine Scale Sets (VMSS) and Azure Kubernetes Service (AKS).
For the AZ-400 certification exam, candidates must understand the internal routing mechanics of deployment slots, configure application warmup to prevent cold-start penalties, differentiate sticky configuration settings from swappable parameters, execute advanced two-phase preview swaps, and configure Kubernetes rolling update parameters.
1. Azure App Service Deployment Slots Architecture
Deployment slots are live apps with their own hostnames, running within the same Azure App Service Plan as the primary production web application. They are available in the Standard , Premium , and Isolated App Service tiers. [Inbound User Traffic]
- │
- ▼
- [Azure Front-End Routing Fabric]
- │
- (Routing Rules & VIP)
- ┌───────────────────┴───────────────────┐
- ▼ ▼
- [Production Slot: contoso.azurewebsites.net] [Staging Slot: contoso-staging.azurewebsites.net]
- 100% Production Traffic • 0% External Traffic (Isolated)
- Live Code Version 1.0 • Newly Deployed Code Version 2.0
- Production DB Connection (Sticky) • Staging DB Connection (Sticky)
- │ │
- └───────────────────┬───────────────────┘
- ▼
- [Shared App Service Plan Compute]
- (Shared CPU, RAM & Worker Cores)
- Core Benefits of Deployment Slots
Isolated Validation : Developers can deploy new container images or code packages to a non-production slot (e.g., staging ) and execute comprehensive smoke tests, API integration tests, and security scans against real Azure infrastructure rather than a simulated local machine.
Zero-Downtime Swapping : When promoting code from staging to production, Azure does not copy files or restart the production web worker processes. Instead, it reconfigures the virtual IP routing rules on the underlying Azure front-end load balancers, switching traffic instantaneously.
Instant Fallback : If an issue is identified immediately after swapping, the team can swap back to return the previous version to production within seconds.
Compute Resource Sharing Warning : Because deployment slots reside within the same App Service Plan , the staging slot consumes CPU, memory, and disk I/O from the exact same underlying VM instances. Running heavy performance or load tests against a staging slot can saturate system resources and cause degradation or outages in the production slot.
2. Anatomy of a Slot Swap Operation & Warmup Mechanics
Understanding the exact sequence of events during an App Service slot swap is essential for the AZ-400 exam. [Step 1: Apply Target Settings] ──► Target slot (Staging) receives Production configuration
- │
- ▼
- [Step 2: Warmup Pings] ──► Azure sends HTTP requests to warmup paths on all instances
- │
- ▼
- [Step 3: Health Probe Check] ──► Wait for HTTP 200 responses; verify app is fully initialized
- │
- ▼
- [Step 4: Front-End VIP Swap] ──► Front-end routing redirects live traffic to warmed instances
- │
- ▼
- [Step 5: Previous Prod Staged] ──► Old production code is now running in Staging slot
- What Happens During a Swap
Configuration Application : Azure applies the destination slot's settings (e.g., production settings) to the source slot (e.g., staging). This causes the staging worker process to restart and reload configuration.
Application Warmup : Azure issues HTTP requests to the root path ( / ) or to custom warmup paths defined in the application configuration on every scaled-out VM instance in the staging slot.
Readiness Confirmation : Azure waits for the worker instances to return successful HTTP status codes (200–299). If any instance fails the warmup probe, the swap operation is aborted, and production remains completely untouched.
Routing Redirection : Once all staging instances are fully warmed and initialized, the Azure front-end load balancer switches routing tables. Inbound requests to contoso.azurewebsites.net are now routed to the newly warmed worker instances.
Completion : The previous production version now runs in the staging slot ( contoso-staging.azurewebsites.net ), serving as an instant fallback.
Mitigating Cold Starts with Application Initialization
In JIT-compiled runtimes (such as ASP.NET Core or Java Spring Boot), the very first HTTP request to a newly launched process incurs significant latency as assemblies are compiled, dependency injection containers are wired, and database connection pools are established. If a swap occurs before initialization completes, initial users experience slow page loads or gateway timeouts.
To mitigate cold starts, developers configure the Application Initialization module in web.config : <system.webServer>
- <applicationInitialization doAppInitAfterRestart="true">
- <add initializationPage="/health/warmup" hostName="contoso.azurewebsites.net" />
- <add initializationPage="/catalog/prime-cache" />
- </applicationInitialization>
- </system.webServer>
Additionally, developers can configure specific Azure App Service application settings to govern warmup probes:
WEBSITE_SWAP_WARMUP_PING_PATH : Specifies the exact relative URL path Azure pings to warm up the slot (e.g., /health/ready ).
WEBSITE_SWAP_WARMUP_PING_STATUSES : Specifies the comma-separated acceptable HTTP response codes (e.g., 200,202 ).
3. Slot Settings: Sticky vs. Swappable (Unpinned)
One of the most heavily tested topics on the AZ-400 exam is the distinction between Slot Settings (Sticky) and Standard Settings (Swappable) .
Important
By default, application settings and connection strings are unpinned (swappable) —meaning their values swap across environments during a swap operation. To anchor a setting to a specific slot, you must explicitly flag it as a Deployment Slot Setting (Sticky) .
Categorization of Settings Behavior
- Setting Type Swappable (Follows the Code) Sticky / Slot-Specific (Stays with the Slot)
- Application Code & Binaries Yes (Code moves from Staging to Production) No
Database Connection Strings Never by default! Must be configured as sticky Yes (Points to Prod DB in Prod, Test DB in Staging)
- Custom Domain Names & Hostnames No Yes (Production domain stays anchored to Prod slot)
- SSL Certificates & Bindings No Yes (Stays with the slot)
- App Insights Instrumentation Key Configurable (Default swappable) Recommended Sticky (Segregate telemetry)
- Virtual Network (VNet) Integration No Yes (Slot stays connected to assigned subnet)
General App Settings (Logging Level) Yes (Swaps with code unless marked sticky) Optional (Can mark sticky if environment-specific)
- IP Restrictions / Access Restrictions No Yes (Staging restricted to corporate VPN)
- The "Catastrophic Unpinned Database" Disaster
Consider an application where the database connection string DefaultConnection in the staging slot points to sql-test.database.windows.net , and in the production slot points to sql-prod.database.windows.net .
If DefaultConnection is NOT marked as a slot setting , during the swap, the staging connection string is applied to production!
As a result, the production site begins writing live customer orders into the test database, while the staging site connects to production data. Marking connection strings as Sticky (Slot Setting) prevents this disaster completely.
- 4. Advanced Slot Swap Patterns
- Auto-Swap
Auto-swap streamlines continuous deployment by automatically triggering a slot swap as soon as new code or container images are pushed to a designated slot.
Configuration : Set on the staging slot via the WEBSITE_DEFAULT_AUTO_SWAP_SLOT_NAME = production setting or through the Azure Portal.
Workflow : A CI/CD pipeline pushes code to staging . Azure detects the completion of the deployment, automatically warms up the staging worker instances, and immediately swaps them into production.
Constraint : Auto-swap is not supported if the application uses sticky configuration settings that require custom testing, or if interactive manual verification is required before cutover.
Swap with Preview (Two-Phase Swap)
When deploying major architecture refactors or framework upgrades, DevOps engineers need to test the new code running with production configuration settings before committing to live traffic cutover. Swap with Preview provides this capability through a two-phase process: [Phase 1: Swap with Preview Triggered]
- Azure applies Production configuration to Staging slot
- Staging worker process restarts under Production settings
- Live production traffic STILL points to original Production app
- Engineers browse Staging slot to test against Production DB & Key Vault
- │
- ┌───────┴───────┐
- ▼ ▼
- [Validation Succeeded] [Validation Failed]
- │ │
- ▼ ▼
- [Phase 2: Complete Swap] [Phase 2: Reset / Cancel Swap]
- Instant VIP traffic cutover • Revert Staging configuration
- Zero user impact • Production untouched
Phase 1 (Preview) : Initiated via az webapp deployment slot swap --action preview . Azure applies production configuration settings (connection strings, Key Vault references) to the staging slot and warms it up. Production traffic continues flowing to the existing production app without interruption. Engineers and automated integration suites test contoso-staging.azurewebsites.net directly against production resources.
Phase 2 (Resolution) :
Complete : Run az webapp deployment slot swap --action complete . Azure performs the traffic cutover.
Reset : If tests reveal defects, run az webapp deployment slot swap --action reset . Azure restores staging to its original configuration without production users ever knowing a swap was attempted.
Testing in Production (Traffic Routing Rules)
Azure App Service supports routing a configurable percentage of production traffic to a deployment slot: # Route 15% of live traffic to the staging slot
- az webapp traffic-routing set \
- -resource-group rg-contoso-prod \
- -name app-contoso \
- -distribution staging=15
Session Stickiness : Azure manages user consistency by issuing a routing cookie named x-ms-routing-name . As long as the user retains this cookie, all subsequent HTTP requests route to the same slot, ensuring users do not flicker between versions during a single browsing session.
5. Rolling Deployments in VMSS and Azure Kubernetes Service (AKS)
In containerized and IaaS environments, zero downtime is achieved through Rolling Deployments , where instances or pods are replaced incrementally in batches.
Rolling Upgrades in Azure Virtual Machine Scale Sets (VMSS)
When updating the OS image or custom extension on a VMSS, the Rolling Upgrade Policy guarantees operational availability across fault domains:
batchPercent : The maximum percentage of total VM instances updated in a single batch (e.g., 20%).
maxUnhealthyPercent : The maximum percentage of instances that can be unhealthy simultaneously.
maxUnhealthyUpgradedPercent : Maximum unhealthy instances allowed among upgraded instances before the upgrade halts.
pauseTimeBetweenBatches : A soak time (e.g., PT5M for 5 minutes) allowing new VMs to pass load balancer health probes before the next batch begins.
Rolling Updates in Azure Kubernetes Service (AKS)
In Kubernetes, deployments manage rolling updates via the spec.strategy.rollingUpdate manifest block using two critical parameters: apiVersion: apps/v1
kind: Deployment
metadata:
name: payment-service
spec:
replicas: 10
strategy:
type: RollingUpdate
rollingUpdate:
- maxUnavailable: 1 # Maximum pods unavailable during update
- maxSurge: 2 # Maximum pods created above replica count
template:
metadata:
labels:
app: payment
spec:
containers:
- name: payment
- image: contosoacr.azurecr.io/payment:v2.1
readinessProbe:
httpGet:
- path: /health/ready
- port: 8080
- initialDelaySeconds: 5
- periodSeconds: 5
maxUnavailable : Defines the maximum number (or percentage) of pods that can be taken down during the update process. Setting maxUnavailable: 1 on 10 replicas ensures at least 9 pods are always running and serving traffic.
maxSurge : Defines the maximum number (or percentage) of pods that can be created above the desired replica count. Setting maxSurge: 2 allows Kubernetes to spin up 2 new pods (total 12) while waiting for readiness probes to pass before terminating old pods.
readinessProbe : Crucial exam rule! If a container lacks a readiness probe, Kubernetes assumes the pod is healthy the instant its process starts, routing traffic prematurely and causing request drops during rolling updates.
- 6. Azure CLI & YAML Pipeline Implementation # 1. Create a staging deployment slot
- az webapp deployment slot create \
- -name app-contoso-prod \
- -resource-group rg-contoso \
- -slot staging
- # 2. Configure a database connection string as a STICKY slot setting
- az webapp config connection-string set \
- -name app-contoso-prod \
- -resource-group rg-contoso \
- -slot staging \
- -connection-string-type SQLAzure \
- -settings DefaultConnection="Server=tcp:sql-staging.database.windows.net..." \
- -slot-settings DefaultConnection
- # 3. Perform a Swap with Preview
- az webapp deployment slot swap \
- -name app-contoso-prod \
- -resource-group rg-contoso \
- -slot staging \
- -action preview
- # 4. Complete the swap following successful validation
- az webapp deployment slot swap \
- -name app-contoso-prod \
- -resource-group rg-contoso \
- -slot staging \
- -action complete # Azure Pipelines YAML Slot Swap Task
- task: AzureAppServiceManage@0
- displayName: 'Swap Staging Slot to Production'
inputs:
- azureSubscription: 'ContosoServiceConnection'
- Action: 'Swap Slots'
- WebAppName: 'app-contoso-prod'
- ResourceGroupName: 'rg-contoso'
- SourceSlot: 'staging'
- SwapWithProduction: true
- 7. Realistic Exam Scenario & Common Traps
- Scenario: Healthcare EHR Portal Deployment
Organization : A regional healthcare network hosts an Electronic Health Records (EHR) patient portal on an Azure App Service P3v3 plan. Deployments occur bi-weekly. During the last release, patient appointments could not be loaded for 4 minutes immediately following the deployment, and telemetry reported hundreds of HTTP 504 Gateway Timeouts.
DevOps Root Cause & Remediation :
Root Cause : The deployment pushed code directly to production, forcing worker process recycling. Because the Java application required 90 seconds to initialize Hibernate entities and build cache schemas, incoming user requests hit uninitialized workers, causing 504 timeouts.
Remediation :
Deploy an Azure App Service deployment slot named staging .
Configure WEBSITE_SWAP_WARMUP_PING_PATH pointing to /health/warmup .
Configure database connection strings as Sticky Deployment Slot Settings .
Update the Azure Pipelines release pipeline to deploy artifacts to staging , await warmup completion, and execute a slot swap. Zero user downtime is achieved.
Common Exam Traps to Avoid
Trap: Assuming slot swaps copy files between slots. Slot swaps do not copy or sync code; they update load balancer routing rules. Files remain physically on their original worker instances.
Trap: Forgetting to mark database connection strings as slot settings. If an exam scenario describes test database data appearing in production post-swap, the root cause is always failure to designate the setting as a sticky deployment slot setting.
Trap: Using auto-swap when manual sign-off or two-phase preview testing is required. Auto-swap triggers immediately upon code upload. If testing against production data before cutover is mandated, choose Swap with Preview .