Blue/Green on Azure

Zero-downtime releases on Azure Container Apps

Two microservices on Azure Container Apps, released with blue/green and canary traffic splitting, first by hand with the Azure CLI, then as an Azure Pipeline on a self-hosted agent that builds, validates, deploys at 0% traffic, tests the new revision and only then promotes it.

Year
2026
Category
Cloud, DevOps
Stack
Azure Container AppsAzure Container RegistryAzure PipelinesAzure ReposDockerAzure CLIBashUbuntu VM
Note
Coursework project. The Azure resources have been torn down.
Blue/Green on Azure

This started as a question every team shipping software has to answer: how do you put a new version in front of users without a window where things are broken? Over an assignment and a midterm, I answered it twice on Azure Container Apps: once by hand, and once as a pipeline that does it without me.

Two services, one private registry

The first step was a small microservice pair: an album API and a web front end that calls it. Both images are built into a private Azure Container Registry and deployed as Container Apps in one environment. The front end never hardcodes where the API lives: the API's address is read at deploy time and passed in as an environment variable, so either side can be redeployed without rebuilding the other.

Blue/green and canary, by hand

With the API in multiple-revision mode, a new version runs beside the old one instead of replacing it. Labels make the two addressable: blue is what users get, green is the new revision, reachable through its own label URL for testing while it carries 0% of real traffic. Switching is one traffic command, and so is rolling back: the old revision never went anywhere.

Canary is the gentler version of the same idea: instead of flipping 100% at once, a small share of traffic goes to the new revision first and grows as it proves itself. Doing both by hand with the Azure CLI made the trade-off concrete: blue/green gives an instant, clean cutover; canary limits how many people a bad release can reach.

Then, making it a pipeline

The midterm turned that runbook into an Azure Pipeline. It runs on a self-hosted agent: an Ubuntu VM I provisioned and registered into its own agent pool, against a repo in Azure Repos where main is protected and every pull request has to pass a build before it can merge.

  • Build: the image is built on every run and tagged with both the build ID and the commit SHA, but only pushed to the registry when the run isn't a pull request.
  • Validate: confirms that exact tag exists in the registry, that the app is in multiple-revision mode, and runs the image on the agent itself and calls /albums as a smoke test.
  • Deploy: gated behind a production environment approval. It finds which label holds 100% of traffic, deploys the new revision under the other label, and leaves production traffic untouched.
  • Validation gate: calls the new revision on its own URL with retries, failing fast on a 4xx. If it fails, the pipeline stops and prints the traffic table to prove production was never touched.
  • Promote: switches 100% of traffic to the validated label, checks the production URL, and switches straight back on its own if that check fails.
5
stages from commit to live
0%
traffic on a new revision until it passes
1
manual approval before production
1 click
rollback, verified before switching
Blue/green release pipelineBuildtag: build ID + SHAValidatesmoke test /albumsDeployapproval · 0% trafficGatetest revision URLPromote100% to new labelStoppedproduction untouchedSwitch backif prod check failsfails
Green arrows are the happy path. A failed gate stops the release before any traffic moves; a failed production check switches straight back.

Designing for the bad day

Two run-time parameters exist purely to prove the failure paths work. One simulates a bad release by pointing the validation gate at a route the app doesn't serve, so you can watch promotion get skipped while production keeps serving the old version. The other runs only a rollback stage, which checks that the previous revision still responds before sending any users back to it: rolling back onto something broken is just a second outage.

What I took from it

The deploy itself is the least interesting stage. What makes a release safe is everything around it: a revision that exists before anyone uses it, a test that runs against the real thing, and a way back that's been exercised rather than assumed. Doing it by hand first is what made each pipeline stage obvious when it came time to automate.