Protego field desk
CD Pipelines: Deployment and IaC · part of 50-55% of exam

L11. Deployment Strategies: Blue-Green, Canary, Ring & Feature Flags

Course outlineLesson 11 of 18
AZ-400 Exam Prep: course overview

Blue-green keeps a previous version available for traffic rollback, canary limits blast radius through progressive exposure, ring-based deployment structures that exposure into named waves, and feature flags decouple deploy from release entirely.

Blue-Green Deployment: Traffic Rollback

Blue-green deployment maintains two identical production environments called blue (currently live) and green (next version). To deploy, you run the new version in the green environment, run validation tests, then switch all traffic from blue to green using a load balancer, DNS flip, or traffic manager.

Traffic can be switched back to blue if health checks fail. Rollback also depends on routing propagation, session handling and compatible database or external-state changes; switching code back does not undo writes. Keeping the previous environment available avoids having to redeploy it before routing traffic back; actual recovery time depends on the workload and routing design.

Canary Deployment: Progressive Risk Mitigation

Canary deployment releases a new version to a small slice of traffic first (say 5%), monitors health metrics for errors and latency, and gradually increases traffic (to 25%, then 50%, then 100%) only if signals stay healthy. If a problem is detected during the early percentage, traffic is rolled back to the previous version before the blast radius grows.

Unlike blue-green's all-at-once switch, canary is progressive. It detects issues before they hit 100% of users, making it invaluable for catching bugs or performance regressions that only show up under real traffic patterns.

Ring-Based Deployment: Structured Waves of Risk

Ring-based deployment progresses through predefined "rings" of increasing user scope: Ring 0 (internal team), Ring 1 (early adopter customers), Ring 2 (general availability). Each ring is validated before promoting to the next. This adds structure to the canary concept: instead of arbitrary percentages, rings are named stages aligned to business risk appetite.

Feature Flags: Decouple Deployment from Release

Feature flags (feature toggles) decouple code deployment from feature release. New code is deployed to production with the feature turned off (dark), then enabled for specific users or a percentage of traffic later without any new deployment. Azure App Configuration Feature Manager is the Azure-native service for this.

This is powerful for safety: code can merge and ship during a business lull, then the feature is enabled during peak support hours when on-call teams are standing by.

A/B Testing vs Canary

A/B testing and canary deployment are distinct concepts, though both serve percentages of traffic. A/B testing serves two variants concurrently to measure a business or UX outcome (Does variant B convert better?). Canary is about deployment safety (Does the new code run without errors?). They answer different questions.

Deployment Slots and Swap Safety

Azure App Service supports deployment slots in Standard, Premium and Isolated tiers. Warm and validate a staging slot before swapping it with production. Check sticky settings and managed identities, which do not all swap with application content. A reverse swap restores the earlier code, but cannot undo database writes. Warm-up and health checks reduce downtime risk; they do not guarantee every request survives.

Comparison: Core Strategies

StrategyRollback SpeedBlast Radius ControlBest For
Blue-GreenTraffic switch; state compatibility requiredAll-or-nothing switchSeparate live and candidate environments
CanaryRoute away from candidateCurrent traffic cohortDetecting regressions
Ring-BasedPer-ring promotionStructured wavesEnterprise phased rollout
Feature FlagDisable the flagSelected users or trafficSafe dark deployments
Deployment SlotsReverse swap; validate stateSlot traffic configurationAzure App Service apps

Hotfix Paths

High-priority security fixes need a fast-tracked pipeline path that skips slower, non-essential gates (performance testing, extended soak periods) while keeping mandatory gates (security scans, approvals, automated tests) in place. This balances speed with safety. Exam tip: Match the deployment strategy to the scenario. Canary limits initial exposure, blue-green retains a previous environment, and feature flags control feature availability separately from deployment. Validate health and rollback assumptions for each approach.

References

Continue Learning

Exam Focus Points
  • ✓Blue-green deployment keeps two identical environments and switches traffic between them all at once, enabling traffic rollback if prior code remains compatible with current data and dependencies
  • ✓Canary deployment releases a new version to a small subset of traffic first and expands exposure gradually only if health signals stay good, minimizing the blast radius of a bad release compared to switching all traffic at once
  • ✓Ring-based deployment promotes a release through predefined rings of increasing scope (e.g., internal users, then early adopters, then general availability), validating at each ring before advancing
  • ✓Feature flags decouple code deployment from feature release: code can ship to production turned off, then be enabled for specific users or a percentage of traffic later without a new deployment, and Azure App Configuration Feature Manager is the Azure-native implementation
  • ✓A/B testing serves two variants concurrently to compare a business or UX outcome metric, which is a different goal from canary deployment's purpose of limiting the blast radius of a risky release
Knowledge Check

1. What is the key advantage of blue-green deployment compared to a rolling in-place update?

2. A team wants to release a new version to production but limit exposure to just 5% of traffic initially, expanding gradually only if error rates stay low. Which deployment strategy is this?

3. A team wants to deploy a new feature's code to production now but not actually expose it to any users until a specific date, and then only to 10% of users initially. What technique enables this without a new deployment when the feature is turned on?