Your profile

One profile for every MSDEVBUILD site. Only you can see it, and the site owner if you write in.

Lesson 5 of 28
❮Prev Next❯

Azure Container Apps: Environments and Revisions

Module 1: Containers ⏱ 10 min read Updated

Your note

My notes for this lesson

Select any text in the lesson to highlight it or add a note. Saved in this browser.

    No highlights yet. Select a sentence in the lesson, then pick a colour or add a note.

    All my bookmarks and notes

    Reading settings

    For every lesson, saved in this browser.

    Text size
    Line spacing
    Font

    With IaaS you rent the virtual machine. Microsoft looks after the building, power and hardware; you patch the operating system.

    30-second answer

    Azure Container Apps runs containers without a cluster to manage. Apps live in an environment, a secure boundary with its own network and Log Analytics workspace. Any change to the app's template (image, environment variables, scale rules) creates a new revision, an immutable snapshot. In multiple revision mode you split traffic between revisions with az containerapp ingress traffic set, for example 80% to the old one and 20% to the new one, then roll forward or back.

    Simulate it » No Azure account needed

    Exam objective: 1.2.1 Deploy applications to Azure Container Apps, including environment configuration and revision management. (Skills measured as of October 7, 2026)

    Simulations

    Feel it before you read it. No account needed, nothing leaves this page.

    Azure portal: Create a container app and split traffic between revisions Create a container app, then manage revisions and traffic.
    </> Embed

    Embed this simulation

    Free for trainers, teachers and bloggers. Paste this into your page:

    Loading the portal…

    Open <strong>Container Apps</strong> and select <strong>+ Create → Container App</strong>.

    👆 Click the glowing item in the portal to continue

    Read the steps as text
    1. Open Container Apps and select + Create → Container App.
    2. Name the app and create an environment. Apps in one environment share a network and a Log Analytics workspace.
    3. On Container, turn off the quickstart image and choose your ACR image, tag and size.
    4. Turn on Ingress and set the target port your app listens on. Envoy handles HTTPS for you.
    5. Review and Create.
    6. Every change to the template makes a new revision. In Single mode the new one replaces the old one. For a canary you need Multiple.
    7. Pick Multiple: Several revisions active at the same time.
    8. Deploy image 1.5.0 as v2, then send it 20% of the traffic. Labels give each revision its own URL for testing.

    🧪 Simulation for learning. Screens are simplified versions of the Azure portal; names, prices and IDs are examples. Nothing here touches real Azure.

    😟 THE PROBLEM

    A new model version broke answers for every user at once.

    😊 THE SOLUTION

    Deploy it as a new revision and send it 10% of traffic first.

    • All-or-nothing releases✓ Traffic splitting
    • Slow rollbacks✓ Move traffic back to the old revision
    • Managing Kubernetes✓ Serverless environment
    🛠️ Solved with: Container Apps revisions

    Start with a question

    You've got a new model prompt. How do you test it on 10% of users first?

    If you swap the image for everyone and the new prompt gives worse answers, every user sees it before you notice. You’d rather send a small slice of traffic to the new version, watch it, then move everyone across, or back.

    Azure Container Apps does this with revisions. Every deploy creates a new snapshot of the app, and you choose how much traffic each one gets.

    Explain it like I’m 10

    Visual: revisions in motion

    See a template change create a new revision, then an 80/20 traffic split and a rollback that rebuilds nothing.

    ▶ Explainer video See it in motion 7 steps · 1 min 42 sec

    An animation of an Azure Container Apps environment holding the ragapi app, showing a template change creating a new immutable revision, switching to multiple revision mode, splitting traffic 80/20 between two revisions, and rolling back by moving all traffic to the old revision.
    Read the video script
    1. Start with an environmentIn Container Apps, everything lives in an environment. Think of it as a boundary. Apps inside it share one network and send their logs to the same Log Analytics workspace.
    2. Deploy the app, get revision oneDeploy the ragapi app, and Container Apps makes its first revision. A revision is a snapshot of the app's template: the image, the environment variables, the scale rules. You can't edit it afterwards.
    3. Which changes make a revisionNot every change makes a new revision. Change the image, an environment variable or a scale rule, and you get a new one. Change ingress, a secret or the traffic weights, and you don't. Those apply to the whole app.
    4. Switch to multiple revision modeBy default the app is in single revision mode, so a new revision replaces the old one. To run two side by side and split traffic between them, switch to multiple revision mode.
    5. New image, new revisionNow update the image to version one point five. That's a template change, so you get a brand new revision, v15. The old one is untouched and still takes all the traffic.
    6. Split traffic 80/20Next, split the traffic. Eighty percent stays on v14, twenty percent tries v15. You watch errors, latency and answer quality on that small slice before anyone else sees it.
    7. Bad answers? Roll backSay v15 gives worse answers. Rolling back is just moving the weights: a hundred percent back to v14. Nothing gets rebuilt. If v15 had looked good, you'd move the hundred percent to it instead.

    The technical explanation

    Environment first, then the app

    az containerapp env create --resource-group rg-ai --name env-rag --location eastus
    
    az containerapp create --resource-group rg-ai --name ragapi \
      --environment env-rag \
      --image myreg.azurecr.io/ragapi:1.4.0 \
      --registry-server myreg.azurecr.io --registry-identity system \
      --ingress external --target-port 8000 \
      --secrets search-key=keyvaultref:https://kv-rag.vault.azure.net/secrets/search-key,identityref:system \
      --env-vars MODEL_DEPLOYMENT=gpt-4.1-mini SEARCH_KEY=secretref:search-key \
      --min-replicas 1 --max-replicas 5

    A few things to notice. --registry-identity system pulls from ACR with the app’s managed identity. Secrets are stored on the app (or referenced from Key Vault with keyvaultref:), and env vars point at them with secretref:. --target-port is the port your container listens on.

    az containerapp up --name ragapi --source . is the shortcut: it builds the image (with ACR), creates the resource group, environment and registry if needed, and deploys, all in one command.

    The environment is the shared boundary: apps in it share a virtual network and send logs to the same Log Analytics workspace. Ingress is either external (internet) or internal (only apps in the same environment, which call each other by app name).

    Revisions

    ChangeScopeNew revision?
    Image, env vars, CPU/memory, probes, scale rulesRevision (properties.template)Yes
    Ingress, traffic weights, secrets, registries, revision mode, DaprApplication (properties.configuration)No
    # Deploy 1.5.0 as a new revision with a readable name: ragapi--v15
    az containerapp update -g rg-ai -n ragapi \
      --image myreg.azurecr.io/ragapi:1.5.0 --revision-suffix v15
    
    az containerapp revision list -g rg-ai -n ragapi -o table

    In single revision mode (the default), the new revision takes all traffic once it’s healthy and the old one is deactivated. To keep both running and split traffic, switch to multiple:

    az containerapp revision set-mode -g rg-ai -n ragapi --mode multiple
    
    az containerapp ingress traffic set -g rg-ai -n ragapi \
      --revision-weight ragapi--v14=80 ragapi--v15=20

    Roll forward by moving weights to 100 on ragapi--v15; roll back by moving them to the old revision. You can also add a label (az containerapp revision label add --label blue --revision ragapi--v15) to get a stable URL for testing a revision directly.

    1. 1 Multiple mode

      revision set-mode --mode multiple.

    2. 2 New revision

      update --image 1.5.0 creates ragapi--v15.

    3. 3 Split

      ingress traffic set sends 80/20.

    4. 4 Decide

      100% to v15, or 100% back to v14.

    A canary release with revisions
    Architect level Workload profiles and what you pay for

    New environments use the workload profiles model. The Consumption profile bills per vCPU-second and GiB-second while replicas run, with a monthly free grant, and scales to zero. Dedicated profiles give you reserved node types (including GPU options) for steady or heavy workloads, billed per node. Apps in the same environment can mix profiles. An environment can be created in your own virtual network so apps reach private endpoints for Cosmos DB, Key Vault or Azure OpenAI.

    Real-world business scenario

    Education technology

    Litware Learning (fictional)

    The problem
    Each new prompt template for their tutoring assistant went live to every student at once. One release gave long, off-topic answers for half a day before anyone rolled it back.
    What they used
    Azure Container Apps in multiple revision mode. Each release gets a revision suffix, starts at 10% traffic, and moves up only if Application Insights shows good feedback scores and no extra errors.
    Why that choice
    Revisions are immutable, so rolling back is just moving traffic weights, with no rebuild or redeploy.
    The result
    Bad releases now reach a small slice of students and get rolled back in minutes.

    When to use it and when not to

    ✓ Use it when…

    • APIs and microservices for an AI app that you want to run without managing Kubernetes.
    • Canary or blue-green releases with traffic splitting between revisions.
    • Private service-to-service calls within an environment using internal ingress.

    ✕ Think twice when…

    • Workloads that need the Kubernetes API, custom operators or CRDs.
    • A single web app that needs deployment slots and nothing else.

    ↔ Alternatives to consider

    • AKS for full Kubernetes control.
    • App Service for one container with slots and the least to learn.
    Ready for more?The full lesson adds the technical explanation, when to use it, interview questions and revision notes.

    Test yourself with exercises

    5 original practice questions in the AI-200 style. Pick your answers, then check them. You will see why each option is right or wrong. Score 75% or more and this topic is marked complete.

    Question 1

    Question 1 of 5

    A container app named ragapi uses single revision mode. You need to send 20 percent of traffic to a new revision and 80 percent to the current revision. What should you do first?

    Question 2

    Question 2 of 5 · Select 2

    Which TWO changes to a container app create a new revision?

    Question 3

    Question 3 of 5

    You deploy two container apps, api and worker, to the same Container Apps environment. The worker must be reachable from the api app but must not be reachable from the internet. How should you configure ingress for the worker?

    Question 4

    Question 4 of 5

    A container app must expose the value of an app secret named search-key to the container as an environment variable named SEARCH_KEY. Which value should you use in the --env-vars parameter?

    Question 5

    Question 5 of 5

    A container app runs in multiple revision mode with revisions ragapi--v1 and ragapi--v2. You need to send 90 percent of traffic to ragapi--v1 and 10 percent to ragapi--v2. Which command should you run?

    Interview preparation

    Say your answer out loud first, then open the model answer. Interviewers care more about your reasoning than the exact words.

    Beginner What's a revision in Container Apps?

    Model answer

    A read-only snapshot of the app's template: image, environment variables, resources and scale rules. Every time I change one of those, Container Apps makes a new revision. I can't edit an old revision, only activate, deactivate or send traffic to it.

    Intermediate Which changes create a new revision and which don't?

    Model answer

    Revision-scope changes do: anything under properties.template, like a new image, env vars, CPU and memory, or scale rules. Application-scope changes don't: ingress, secrets, registry credentials, revision mode and Dapr settings apply to all revisions.

    Interviewer follows up

    So if you change a secret, does the app see it?

    You

    Not automatically. Existing revisions keep the old value until I restart them or create a new revision.

    Experienced developer How would you do a canary release of a new model version?

    Model answer

    Set the revision mode to multiple, deploy the new image with a revision suffix so I know its name, then run az containerapp ingress traffic set with 90 on the old revision and 10 on the new one. I watch errors and latency, raise the weight, and when I'm happy send 100 to the new revision and deactivate the old one.

    Scenario A worker app must be reachable by the API app but never from the internet. How do you configure it?

    Model answer

    Put both in the same environment and give the worker internal ingress. The API calls it by app name, like http://worker, and nothing outside the environment can reach it.

    Quick revision

    Key points

    • An environment groups container apps with a shared network and Log Analytics workspace.
    • az containerapp create or up deploys an image; --env-vars, --secrets and secretref connect configuration.
    • Revision-scope changes (template) create a revision; application-scope changes (ingress, secrets) don't.
    • Single revision mode is the default; set multiple with az containerapp revision set-mode.
    • Split traffic with az containerapp ingress traffic set --revision-weight.

    Important terminology

    Container Apps environment
    The boundary that container apps share, with one virtual network and one logging destination.
    Revision
    An immutable snapshot of a container app's template, created whenever a revision-scope setting changes.
    Revision mode
    Single (one active revision, the default) or multiple (several active revisions with traffic splitting).
    Ingress
    The setting that exposes an app over HTTP or TCP, externally to the internet or internally within the environment.
    secretref
    The way an environment variable points at a container app secret instead of holding the value.

    Common mistakes

    • Expecting a secret change to reach running revisions without a restart or new revision.
    • Trying to split traffic while the app is still in single revision mode.

    Exam tips

    • "Gradually move users to a new version" = multiple revision mode + traffic splitting.
    • "Only other apps in the environment can call it" = internal ingress.
    • "Roll back instantly" = send 100% of traffic to the previous revision.

    Five quick revision questions

    1. 1.What creates a new revision?Show

      A change to the template, such as image, env vars or scale rules.

    2. 2.What is the default revision mode?Show

      Single.

    3. 3.Which command switches to multiple revision mode?Show

      az containerapp revision set-mode --mode multiple

    4. 4.Which command splits traffic between revisions?Show

      az containerapp ingress traffic set

    5. 5.How does an env var read a container app secret?Show

      With secretref, for example SEARCH_KEY=secretref:search-key.

    Official references

    Finished this lesson? Tick it off. Your progress is saved in this browser.

    Next up: Event-Driven Scaling with KEDA in Container Apps

    Studying with a friend? Send them this lesson

    It's free and needs no sign-up. Their progress saves in their own browser.

    Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges. Play ❯

    Install MSDEVBUILD Azure

    Free · no account · works offline

    Save the whole course for offline ›

    Hi, I’m your Nimbus

    Your study buddy. Pick what we do next.

    MSDEVBUILD · Multi-Stack Dev Build

    Sign in to MSDEVBUILD

    One account for Azure certifications and the blog: sign in here and you are signed in on both. Your XP, streak, practice deck and certificate stay in sync on every device. Optional: everything works without an account.