Skip to content
Visual explainer 3h to learn 5 steps

Progressive releases across Azure environments

Promote one image through environments with slots or revisions, health gates, migrations and rollback.

By Invicly Tech, , in Microsoft Azure Cloud Engineering. About 13 minutes to read.

Topic 22 of 33

In short

A progressive release moves one tested build through environments and then shifts live traffic to it in small, reversible steps. On Azure you do this with Container Apps revisions or App Service deployment slots, guarded by health checks and smoke tests. Database migrations are planned so the old and new versions can run side by side, which keeps rollback fast.

Think of it like this: It is like opening a new road lane by lane while the old road stays open, so you can close the new one the moment something goes wrong.

Explained simply

Most outages start with a change. A progressive release makes changes smaller and safer. You build your app once, test that exact build in each environment, then give it to a few real users before everyone. If something looks wrong, you switch back quickly.

Azure gives you two common tools for this. Azure Container Apps keeps each version of your app as a revision, and you can split traffic between revisions by percentage. Azure App Service has deployment slots: a staging copy of your app that you can swap with production in one step.

Checks decide when to move forward. Health checks tell Azure whether an instance is ready. Smoke tests call the most important pages or API routes. Metrics such as error rate and response time tell you if real users are happy.

The database is the tricky part. If the new version changes the schema in a way the old version cannot handle, you cannot go back. So schema changes are split into small, safe steps spread across releases.

Press Play on a diagram to walk through it one step at a time.

FlowOne image, many environments
  1. 1
    Build once

    Image tagged with the commit SHA, pushed to ACR

  2. 2
    Dev

    Deploy by digest, run tests

  3. 3
    Staging

    Same digest, migrations, smoke tests

  4. 4
    Production at 10 percent

    New revision or slot gets a slice of traffic

  5. 5
    Production at 100 percent

    Promote when health gates stay green

CompareContainer Apps revisions or App Service slots
Container Apps revisions
  • Every template change creates a revision
  • Multiple revision mode keeps old ones active
  • Traffic split by weight or label
  • Rollback: move traffic back to the old revision
App Service slots
  • Separate live apps with their own host names
  • Standard tier or higher
  • Swap staging into production after warm-up
  • Rollback: swap again
FlowRenaming a column with expand and contract
  1. Step 1
    Release 1: expand

    Add account_id, nullable

  2. Step 2
    Release 2: dual write

    Write both columns, read account_id

  3. Step 3
    Backfill

    Copy customer_id to account_id in batches

  4. Step 4
    Release 3: contract

    Stop writing customer_id, then drop it

In depth

Build once, promote everywhere

The build pipeline creates the container image a single time, tags it with the commit SHA, and pushes it to Azure Container Registry. From then on every environment deploys that image by digest, the sha256 value that identifies its exact contents. What changes between environments is configuration: environment variables, Key Vault references, connection settings and scale rules. This is what makes testing meaningful, because the bits that passed staging are the bits production runs. If you keep separate registries per environment, copy the image with az acr import rather than rebuilding. Avoid moving tags such as latest in deployments; a tag can point at a new image tomorrow, while a digest cannot. Record the digest in the release notes or deployment output so you know exactly what to roll back to.

  • Tag with the commit SHA, deploy by digest
  • Configuration differs; the image does not
  • az acr import to copy between registries
  • Record the running digest for rollback

Container Apps revisions and traffic splitting

Each change to a Container App's template, such as a new image, creates a revision named app--suffix. In single revision mode, the default, the new revision replaces the old one once it is ready. For canary releases switch to multiple revision mode, where several revisions stay active and ingress splits traffic by weight. Important detail: if traffic is assigned to the latest revision, a new revision receives all traffic as soon as it is ready. So first pin traffic to the current revision by name, then deploy, and the new revision starts at 0 percent. Labels give a revision its own stable URL, which is ideal for smoke tests before any users see it. Readiness probes stop traffic reaching replicas that are not ready, and startup probes give slow apps time to boot.

SequenceCanary with Container Apps revisions
Pipeline
Container App
Revision v42
Monitoring
  1. 1Pin 100 percent to v41, deploy image as v42
    Pipeline to Container App: Pin 100 percent to v41, deploy image as v42
  2. 2Start v42 at 0 percent, label staging
    Container App to Revision v42: Start v42 at 0 percent, label staging
  3. 3Smoke tests on the label URL
    Pipeline to Revision v42: Smoke tests on the label URL
  4. 4Shift 10 percent to v42
    Pipeline to Container App: Shift 10 percent to v42
  5. 5Error rate and latency stay normal
    Monitoring to Pipeline: Error rate and latency stay normal
  6. 6Shift 100 percent, deactivate v41 later
    Pipeline to Container App: Shift 100 percent, deactivate v41 later

App Service deployment slots

Deployment slots are available on Standard tier and above. A slot such as staging is a full live app with its own host name. You deploy to staging, test it, then swap. During a swap, App Service applies production's settings to the staging instances, waits for them to warm up by calling the site (or a path you set with WEBSITE_SWAP_WARMUP_PING_PATH), and then switches routing, so users see no cold start. Settings marked as deployment slot settings stay with their slot, which is how production keeps its own connection strings. Swap with preview pauses after applying settings so you can test before finishing. To roll back, swap again: the previous version is still sitting in the staging slot. You can also route a percentage of production traffic to a slot for a gentle canary.

  • Standard tier or higher
  • Mark environment-specific settings as slot settings
  • Warm-up runs before routing switches
  • Rollback: swap again

Health gates and smoke tests

A gate is a check that must pass before the release moves on. Use three layers. Platform health checks, such as Container Apps probes or the App Service health check path, keep broken instances out of rotation automatically. Smoke tests are a few fast scripted calls after deploy: the health endpoint, a sign-in, one read and one write with synthetic data. Metric gates compare the new version with the old during a short soak period, for example five-xx error rate below 1 percent and p95 latency within 20 percent of the baseline for ten minutes, using Application Insights or Azure Monitor. Write the thresholds down before the release, so the decision is not made in the heat of the moment. Any failed gate means stop and shift traffic back.

CycleShift, watch, decide
  1. 1
    Shift a slice

    0, 10, 50, 100 percent

  2. 2
    Soak

    Wait a fixed period under real traffic

  3. 3
    Compare

    Errors and latency against the old version

  4. 4
    Decide

    Continue, hold, or roll back

  5. Back to step 1

Migrations and rollback

Application rollback is only fast if the database still works with the old code. Use expand and contract. Expand: add new tables or nullable columns in a migration that the old code ignores, and run it before shifting traffic, for example as a Container Apps job or a pipeline step. Release code that writes both old and new shapes and reads the new one. Backfill existing rows in batches. Contract: once no running version uses the old column, drop it in a later release. Never rename or drop in the same release that starts using the new shape. With this discipline, rollback is a traffic change that takes seconds. When a release has already changed data in a way the old code cannot read, rolling forward with a fix is often safer than rolling back.

  • Expand first, in its own step
  • Old and new code must both work with the schema
  • Backfill in batches
  • Contract in a later release

Learn it in 5 short steps

About 35m each. Track them with a timer in your plan.

  1. 1
    Promote one immutable image~35m
  2. 2
    Use slots or revisions~35m
  3. 3
    Gate on health and smoke tests~35m
  4. 4
    Sequence database migrations~35m
  5. 5
    Roll back quickly~35m

Key points

  • Promote the same image digest everywhere; only configuration changes per environment.
  • Send a small share of traffic first and watch error rate and latency before going further.
  • Health checks gate traffic automatically; smoke tests prove key journeys still work.
  • Use expand and contract migrations so old and new code both work with the schema.
  • Rollback should be one command that shifts traffic back, practised before you need it.

Key terms

Tap a card to flip it. 0/5 known

Examples

A canary release on Container Apps

Prerequisites: a Container App named api in rg-shop-prod with ingress enabled, currently running revision api--v41, and an image already in the registry. Step 1: switch to multiple revision mode and pin traffic to v41 by name. Step 2: deploy the new image by digest with revision suffix v42; it starts at 0 percent. Step 3: add a label and run smoke tests against the label URL. Step 4: send 10 percent, watch errors and latency for ten minutes. Step 5: promote to 100 percent. Evidence: az containerapp revision list shows the traffic weights you set. Rollback at any step: set v41 back to 100.

bash
APP="-n api -g rg-shop-prod"
az containerapp revision set-mode $APP --mode multiple
az containerapp ingress traffic set $APP --revision-weight api--v41=100
az containerapp update $APP --revision-suffix v42 \
  --image crcontoso.azurecr.io/api@sha256:<digest>
az containerapp revision label add $APP --label staging --revision api--v42
az containerapp ingress traffic set $APP --revision-weight api--v41=90 api--v42=10
az containerapp revision list $APP -o table
# promote:  az containerapp ingress traffic set $APP --revision-weight api--v42=100
# rollback: az containerapp ingress traffic set $APP --revision-weight api--v41=100

A slot swap on App Service

Prerequisites: an App Service app on Standard tier or higher, with a health check path of /healthz. Step 1: create a staging slot and mark the database connection string as a deployment slot setting in both slots. Step 2: deploy the build to staging. Step 3: run the smoke test against the staging host name, which you can copy from the slot's overview page. Step 4: swap staging into production. Evidence: production serves the new version string from /version, and the staging slot now holds the previous version. Rollback: run the same swap command again. Cleanup for a lab: delete the resource group.

bash
az webapp deployment slot create -g rg-shop-prod -n app-shop-prod --slot staging
az webapp deploy -g rg-shop-prod -n app-shop-prod --slot staging \
  --src-path app.zip --type zip
curl -fsS https://<staging-host>/healthz && curl -fsS https://<staging-host>/version
az webapp deployment slot swap -g rg-shop-prod -n app-shop-prod \
  --slot staging --target-slot production
# rollback: run the same swap command again

Quick reference

  • Build once, tag with the commit SHA, deploy by digest in every environment
  • Container Apps canary needs multiple revision mode; pin traffic by name before deploying
  • Revision labels give a stable URL for smoke tests at 0 percent traffic
  • App Service slots need Standard tier or higher; rollback is another swap
  • Mark environment-specific App Service settings as deployment slot settings
  • Write gate thresholds before release: error rate, p95 latency, soak time
  • Expand and contract: add first, dual write, backfill, drop in a later release

Common mistakes

  • Rebuilding the image for each environment, so production runs code that was never tested.
  • Running a destructive migration before the traffic shift, which makes rolling back the app useless.
  • Leaving App Service slot settings that should stay with an environment unmarked, so they swap into production.

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1In multiple revision mode, traffic is set to 100 percent on the latest revision. You deploy a new image. What happens?

Question 2

2What is the fastest rollback after an App Service slot swap?

Question 3

3Why deploy by image digest rather than by tag?

Question 4

4Which migration is safe to run before shifting traffic to the new version?

Question 5

5A setting should stay with the production slot when you swap. What do you do?

0/5 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    List the revisions of a Container App with their traffic weight and state, and then move all traffic to revision api--v41.

  2. Exercise 2medium

    Write down gate criteria for a 10 percent canary of a checkout API, including soak time, metrics, thresholds and who decides.

  3. Exercise 3hard

    Write a bash script for a pipeline step that shifts 10 percent to a new revision, checks a health URL 20 times, and rolls back automatically if any check fails.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

Is blue-green the same as canary?
Not quite. Blue-green switches all traffic from the old copy to the new one at once, as an App Service swap does. Canary sends a small share first and grows it, as Container Apps traffic weights allow.
Do deployment slots cost extra?
Slots run on the same App Service plan as production, so they share its compute and do not add a separate plan charge. They do use the plan's capacity, and they need Standard tier or higher.
How long should old revisions stay active?
Keep the previous revision until the new one has run through a full normal traffic cycle, often a day. Then deactivate it to free resources, but keep the image so you can redeploy it.
What if a migration already broke compatibility?
Then rolling back the app will not help on its own. Roll forward with a fix, or restore the database to a point in time if data was damaged, which is why expand and contract matters.

Go deeper

ShareXLinkedInWhatsApp