# Canary deployment manifestapiVersion:apps/v1kind:Deploymentmetadata:name:myapp-canaryspec:replicas:1# 1 canary pod vs 9 stable = 10% canary trafficselector:matchLabels:app:myapptrack:canarytemplate:metadata:labels:app:myapptrack:canaryspec:containers:-name:myappimage:myapp:v1.1
Ring Deployment
A structured set of progressive rollout rings, typically used for large-scale infrastructure or software:
1
2
3
4
5
Ring 0: Internal users (developers/dogfood)
Ring 1: Early adopters / preview users (~1%)
Ring 2: Limited external rollout (~10%)
Ring 3: Broader rollout (~50%)
Ring 4: General availability (100%)
Each ring has automated health gates — only promote if metrics are healthy.
Used extensively by Microsoft for Windows Updates, Azure services, and Microsoft 365 releases.
Feature Flags (Feature Toggles)
Types of feature flags:
| Type | Lifetime | Example |
|——|———-|———|
| Release toggle | Short-term | Hide incomplete feature until release |
| Experiment toggle | Medium | A/B test different UX |
| Ops toggle | Long-term | Circuit breaker, kill switch |
| Permission toggle | Permanent | Premium feature for paid users |
Feature flag filters (Azure App Configuration):
| Filter | Description |
|——–|————-|
| TargetingFilter | Enable for specific users/groups/percentage |
| TimeWindowFilter | Enable between specific dates/times |
| PercentageFilter | Enable for a random X% of requests |
Pipeline integration — toggle flag with pipeline variable:
1
2
3
4
5
6
-task:AzureAppConfiguration@5inputs:azureSubscription:'MyConnection'AppConfigurationEndpoint:'https://myconfig.azconfig.io'KeyFilter:'App:*'Label:'$(Build.SourceBranchName)'# Use branch as label
A/B Testing
Show version A to group 1, version B to group 2
Measure business metrics (click-through rate, conversion, session duration)
Statistical significance determines winner
Azure implementation:
Azure Front Door with rules for request routing based on headers/cookies
# Azure Pipelines — rolling strategyjobs:-deployment:RollingDeploystrategy:rolling:maxParallel:25%# Deploy to 25% of targets at a timepreDeploy:steps:-script:echo "Health check before deploy"deploy:steps:-script:echo "Deploy new version"routeTraffic:steps:-script:echo "Enable traffic to new instances"postRouteTraffic:steps:-script:echo "Monitor for 5 minutes"on:failure:steps:-script:echo "Rollback"success:steps:-script:echo "Cleanup old version"
Deployment Slots (Azure App Service)
Slot settings (sticky settings):
Some settings should NOT swap with slots (e.g., connection strings pointing to production DB)
Mark as “Slot setting” in App Service configuration — they stay with the slot
1
2
3
4
5
# Configure a sticky slot setting
az webapp config appsettings set\--name myApp \--resource-group myRG \--slot-settings"ENVIRONMENT_NAME=production"
Hotfix Path Plan
When you need to fix a critical production bug urgently:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
main (v2.x development)
│
│
release/1.5.0 ───┤
│ │
├── hotfix/payment-fix (branch from release or tag)
│ │
│ Fix the bug ──► PR ──► Merge to release/1.5.0
│ │
│ Tag v1.5.1
│ │
│ Deploy to production
│
└──► Also cherry-pick or merge fix back to main
(prevent regression in next major release)
Pipeline for hotfixes:
1
2
3
4
5
6
7
8
9
10
11
12
13
trigger:branches:include:-hotfix/*# Skip long-running tests; run only critical tests for hotfixsteps:-script:dotnet test --filter Category=Smoke-task:AzureWebApp@1condition:succeeded()inputs:appName:'myApp'package:'$(Build.ArtifactStagingDirectory)/**/*.zip'
Resiliency Strategy for Deployments
Practice
Description
Health endpoints
/health endpoint checked by load balancer and pipeline
Readiness probes
Kubernetes/container probe — only route traffic when ready
Circuit breaker
Stop sending requests to a degraded downstream service
Retry policies
Exponential backoff for transient failures
Rollback triggers
Auto-rollback when error rate exceeds threshold
Multi-region deployment
Deploy to secondary region if primary fails
Availability Zones
Deploy across AZs for infrastructure-level resiliency
Auto-rollback with Azure Monitor gate:
1
2
3
4
5
6
Deploy ──► Monitor Azure Monitor Alerts (15 min window)
│
┌─────┴─────┐
No alerts Active alerts
│ │
Continue ROLLBACK (swap slots back / redeploy previous)
Application Deployment Methods
Containers
1
2
3
4
5
6
7
8
9
10
11
# Azure Pipelines — deploy container to AKS-task:KubernetesManifest@1inputs:action:'deploy'kubernetesServiceConnection:'MyAKSConnection'namespace:'production'manifests:|k8s/deployment.yamlk8s/service.yamlcontainers:|myregistry.azurecr.io/myapp:$(Build.BuildId)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# GitHub Actions — build and push to ACR, deploy to AKS-name:Build and push imageuses:azure/docker-login@v2with:login-server:myregistry.azurecr.iousername:$password:$-run:|docker build -t myregistry.azurecr.io/myapp:$ .docker push myregistry.azurecr.io/myapp:$-uses:azure/k8s-deploy@v5with:namespace:productionmanifests:./k8s/images:myregistry.azurecr.io/myapp:$
# Using Entity Framework Core migrations-task:DotNetCoreCLI@2displayName:'ApplyEFCoreMigrations'inputs:command:'custom'custom:'ef'arguments:>database update--project src/MyApp.Data--startup-project src/MyApp.Api--connection "$(DB_CONNECTION_STRING)"# Using DACPAC (SQL Server)-task:SqlAzureDacpacDeployment@1inputs:azureSubscription:'MyConnection'AuthenticationType:'servicePrincipal'ServerName:'myserver.database.windows.net'DatabaseName:'mydb'deployType:'DacpacTask'DeploymentAction:'Publish'DacpacFile:'$(Build.ArtifactStagingDirectory)/MyApp.dacpac'AdditionalArguments:'/p:BlockOnPossibleDataLoss=false'# Using Flyway (multi-database migration tool)-script:|flyway -url=jdbc:sqlserver://$(DB_SERVER) \-user=$(DB_USER) \-password=$(DB_PASSWORD) \-locations=filesystem:./migrations \migrate
Ordering dependency deployments:
1
2
3
4
5
6
7
8
9
10
11
12
13
stages:-stage:DeployDatabasejobs:-job:MigrateDBsteps:-script:flyway migrate-stage:DeployAppdependsOn:DeployDatabase# ← App only deploys after DB is updatedcondition:succeeded('DeployDatabase')jobs:-deployment:DeployApp...
🧠 Key Exam Tips for Deployments
Scenario
Answer
Zero-downtime deployment with fast rollback
Blue-Green with deployment slot swap
Gradually expose new version to users
Canary or Ring deployment
Hide an incomplete feature in production code
Feature flag (Azure App Configuration)
A/B test two different checkout flows
A/B testing with Azure Front Door routing
Apply DB schema changes before app deployment
Separate DB migration stage with dependsOn
Rollback if error rate spikes post-deployment
Post-deployment monitoring gate + auto-swap back
Critical bug in production — fast path
Hotfix branch from release tag → short pipeline → cherry-pick to main