Lesson 2 of 3 Deploying Applications to Azure Container Apps

Managing Revisions and Traffic in Container Apps

This lesson explains revisions, which changes create them, the revision modes, and how traffic splitting and labels support safe releases.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish revision-scope from application-scope changes.
  • Compare single and multiple revision modes.
  • Describe traffic weights and labels.
  • Explain how to roll back a release.

What a revision is

A revision is an immutable snapshot of a container app's version: its containers, images, environment variables, resources and scale rules. The first deployment creates the first revision, and later changes create new revisions or apply to existing ones depending on what changed. Each revision has a name made of the app name and a suffix, generated automatically or set explicitly, such as orders-api--v42.

Revisions are what make releases safe. Because an old revision is not modified, returning to it is a reliable rollback; because several revisions can run at once, a new version can receive a fraction of traffic before it receives all of it. Container Apps keeps up to 100 inactive revisions by default, and inactive revisions are not billed.

Revision-scope and application-scope changes

The container app resource has two main sections, and the section that changes decides whether a new revision is created.

Revision-scope change
Resource sectionproperties.template
ExamplesImage, environment variables, CPU and memory, scale rules, probes, revision suffix
Creates a revisionYes
Choose when Shipping a new version of the code or its runtime settings
Application-scope change
Resource sectionproperties.configuration
ExamplesSecret values, ingress, traffic weights, labels, revision mode, registry credentials, Dapr settings
Creates a revisionNo; applies to all revisions
Choose when Changing how the app is reached or what it is allowed to use

This distinction explains several behaviours that appear in exam questions. Updating a scale rule creates a new revision, so a single-revision app briefly runs the new revision alongside the old one during the switch. Updating a secret does not create a revision, so running containers do not see the new value until the revision restarts, with az containerapp revision restart, or until a new revision is created.

Sort into groups

Does it create a revision?

Exam skills 1.2.1

Decide whether each change creates a new revision or applies to all revisions.

Log in to try this activity Interactive activities are free with an account.

Revision modes

The revision mode decides how many revisions can be active at once.

  • Single (the default): when a new revision is created and becomes ready, traffic moves to it and the previous revision is deactivated. If the new revision fails to become ready, traffic stays on the old one, so a broken deployment does not cause downtime.
  • Multiple: several revisions stay active, traffic is split between them by percentage, and old revisions are deactivated only when you choose. This mode supports blue-green and canary releases and A/B tests.
  • Deployment labels (preview): revisions are managed through named labels such as staging and production, with label-based traffic and swaps.

A new revision in single mode counts as ready when it has provisioned, has scaled to the previous revision's replica count within its own limits, and all replicas have passed their startup and readiness probes.

True or false

Revision modes

Exam skills 1.2.1

Decide whether each statement about revision modes is true.

Log in to try this activity Interactive activities are free with an account.

Traffic splitting and labels

In multiple revision mode, the ingress has a list of traffic weights that must add up to 100. A weight can name a revision or use latestRevision, which follows whichever revision is newest. A label is a name attached to one revision that gives it its own URL, such as https://orders-api---blue.ENVDOMAIN; requests to a label URL always reach that revision, whatever the weights are. Moving a label to another revision keeps the URL.

The following commands switch to multiple mode, send 10% of traffic to a new revision as a canary, label the new revision so that testers can reach it directly, and finally move all traffic to it.

az containerapp revision set-mode --resource-group RG --name orders-api --mode multiple
az containerapp update --resource-group RG --name orders-api \
  --image REGISTRY.azurecr.io/orders-api:8d41e09 --revision-suffix v43
az containerapp ingress traffic set --resource-group RG --name orders-api \
  --revision-weight orders-api--v42=90 orders-api--v43=10
az containerapp revision label add --resource-group RG --name orders-api \
  --label green --revision orders-api--v43
az containerapp ingress traffic set --resource-group RG --name orders-api \
  --revision-weight orders-api--v43=100

A rollback in multiple mode sets the weight back to the old revision, which is still active. In single mode, the old revision can be activated again with az containerapp revision activate, or the app can be updated to the previous image, which creates a new revision.

The following diagram shows how traffic reaches two revisions of a container app during a canary release.

A canary release in multiple revision mode. The new image creates a new revision; traffic weights send 95% of users to the current revision and 5% to the new one, and a label gives testers a fixed URL to the new revision. Because the old revision stays active, setting its weight back to 100% rolls back immediately.
The old revision stays active until the release is complete.
Put in order

A canary release

Exam skills 1.2.1

Put the steps of a canary release with Container Apps revisions in order.

Log in to try this activity Interactive activities are free with an account.
Worked example

A canary release of a new model prompt

A team changes the prompt template and embedding model used by its retrieval API, packaged in a new image. They want 5% of users to receive the new version for a day, testers to reach the new version directly at a fixed URL, and an instant rollback if error rates rise.

The app must use multiple revision mode. Deploying the new image creates a new revision; the traffic weights are set to 95% for the current revision and 5% for the new one; a label on the new revision gives testers a stable URL. If errors rise, setting the weights back to 100% for the old revision rolls back immediately, because the old revision was never deactivated.

Single revision mode would move all traffic to the new revision as soon as it is ready. Creating a second container app would require a separate URL and manual load balancing. Changing only a secret would not create a new revision at all.

Check yourself

Which of these creates a new revision: changing the image tag, changing traffic weights, or adding a secret?

Show answer

Only changing the image tag, because the image is in properties.template. Traffic weights and secrets are in properties.configuration and apply without a new revision.

Exam Tips

Remember for the exam

  • properties.template changes create revisions; properties.configuration changes do not.
  • Single mode is the default and keeps traffic on the old revision if the new one fails.
  • Canary and blue-green releases need multiple revision mode and traffic weights.
  • A label gives one revision a stable URL regardless of traffic weights.