Launch price: every exam for $29.99 a year, for the first 300 buyers. See the price

CertStreak
Menu

Deploy applications to Azure Container Apps, including environment configuration and revision management

A worked example

Put in order

The container app order-api in resource group rg-ecommerce serves an AI-backed API.

  • External ingress is enabled.
  • The app is already in multiple revision mode.
  • The only revision, order-api--v1, receives 100 percent of traffic. The traffic rule assigns this weight to order-api--v1 by revision name, so new revisions get no traffic automatically.
  • A new image has been pushed to myregistry.azurecr.io/order-api, and you know its sha256 digest.

Requirements:

  • Production must reference the new image by its immutable digest.
  • Testers must validate the new revision before any production traffic reaches it.
  • Production traffic must move to the new revision in stages.
  • After the move is complete, order-api--v1 must stop consuming resources but must stay available for rollback.

Which actions should you perform, in order?

Your order

You didn't answer this one.

Correct order
1Run az containerapp update -n order-api -g rg-ecommerce --image myregistry.azurecr.io/order-api@sha256:<digest> --revision-suffix v2 to create revision order-api--v2.
2Run az containerapp revision label add -n order-api -g rg-ecommerce --label canary --revision order-api--v2, and have testers validate the revision through the label URL.
3Move production traffic in stages by running az containerapp ingress traffic set -n order-api -g rg-ecommerce --revision-weight order-api--v1=90 order-api--v2=10, then the same command with --revision-weight order-api--v1=50 order-api--v2=50, and finally with --revision-weight order-api--v1=0 order-api--v2=100.
4Run az containerapp revision deactivate -n order-api -g rg-ecommerce --revision order-api--v1.
Why

Deploying the image by digest creates a revision tied to an immutable image identifier. A revision label provides direct access for tester validation while the production traffic weights remain unchanged. After validation, shift production traffic in stages. Finally, deactivate the old revision to stop its replicas while preserving the option to reactivate it for rollback.

  • Step 1: Run az containerapp update -n order-api -g rg-ecommerce --image myregistry.azurecr.io/order-api@sha256:<digest> --revision-suffix v2 to create revision order-api--v2. Every later step needs the new revision to exist. Updating the image creates that revision, and the digest reference meets the immutability requirement.
  • Step 2: Run az containerapp revision label add -n order-api -g rg-ecommerce --label canary --revision order-api--v2, and have testers validate the revision through the label URL. The label needs an existing revision. Its URL lets testers validate order-api--v2 while production traffic continues to reach order-api--v1.
  • Step 3: Move production traffic in stages by running az containerapp ingress traffic set -n order-api -g rg-ecommerce --revision-weight order-api--v1=90 order-api--v2=10, then the same command with --revision-weight order-api--v1=50 order-api--v2=50, and finally with --revision-weight order-api--v1=0 order-api--v2=100. The required tester validation must finish before the new revision receives production traffic. These successive settings provide the staged transition.
  • Step 4: Run az containerapp revision deactivate -n order-api -g rg-ecommerce --revision order-api--v1. The old revision must serve its remaining traffic during the transition. Deactivate it after the final traffic shift to stop its replicas while retaining it for rollback.
  • Not needed: Run az containerapp revision deactivate -n order-api -g rg-ecommerce --revision order-api--v2 after completing the traffic move. This deactivates the revision that should now serve production traffic and leaves the old revision active. The cleanup requirement applies to order-api--v1.
  • Not needed: Run az containerapp revision set-mode -n order-api -g rg-ecommerce --mode single. Single revision mode does not support traffic splitting, so it prevents the required staged production rollout.
  • Not needed: Run az containerapp update -n order-api -g rg-ecommerce --image myregistry.azurecr.io/order-api:latest. The latest tag can refer to a different image over time and does not meet the requirement to deploy by immutable digest.

Practise this topic until it's automatic.

Ten questions a day, every answer explained, and misses that come back until you beat them.

Start free