Azure Container Apps: Environments and Revisions
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.
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.
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
- Open Container Apps and select + Create → Container App.
- Name the app and create an environment. Apps in one environment share a network and a Log Analytics workspace.
- On Container, turn off the quickstart image and choose your ACR image, tag and size.
- Turn on Ingress and set the target port your app listens on. Envoy handles HTTPS for you.
- Review and Create.
- 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.
- Pick Multiple: Several revisions active at the same time.
- 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.
🖱️ Drag to rotate · scroll or pinch to zoom
Revisions and traffic splitting
Every change to the template (image, env vars, scale rules) creates a new revision, an immutable snapshot. In multiple revision mode you can send 80% of traffic to the old one and 20% to the new one, then roll forward or back.
🤔 What happens if…
Read this tour as text
- Build an image, push it to the registry. Your Python API and everything it needs are packed into a container image. You push it to Azure Container Registry (ACR) as
ragapi:1.4.0. A tag names a version. A digest (sha256:…) names the exact bytes and never changes. - ACR Tasks build in the cloud. ACR Tasks build the image inside Azure, so you don’t need Docker on your laptop.
az acr buildis a quick task. A task can also run on every git commit or when the base image (saypython:3.12-slim) gets a security patch. - App Service runs one container. App Service pulls the image and runs it. App settings become environment variables inside the container. A setting can be a Key Vault reference, so the secret never sits in the image or in the portal in plain text.
- Container Apps environment. An Azure Container Apps environment is a secure boundary with its own virtual network and Log Analytics workspace. Several container apps share it. Ingress decides who can reach each app: external (internet) or internal (only the environment).
- Revisions and traffic splitting. Every change to the template (image, env vars, scale rules) creates a new revision, an immutable snapshot. In multiple revision mode you can send 80% of traffic to the old one and 20% to the new one, then roll forward or back.
- KEDA scales on events. Container Apps uses KEDA scale rules. A Service Bus rule adds replicas as the queue grows (for example one replica per 5 messages), up to max replicas. When the queue empties, it scales back to min replicas, which can be zero.
- AKS runs what the manifest says. On AKS you describe the app in YAML manifests: a Deployment (image, replicas, probes, resources) and a Service (a stable address).
kubectl apply -fsends them. Kubernetes keeps the real state equal to what you declared. - Troubleshoot: logs, events, connectivity. When it breaks, look in three places. Logs (
kubectl logs,az containerapp logs show) show what the app said. Events (kubectl describe,kubectl get events) show what the platform did. Connectivity checks (DNS, ports, ingress) show whether traffic can reach it.
Ship a new version of an API without a big-bang release. Create a container app, switch to multiple revisions, send 20% of users to the new one and check the logs from both sides: Cloud Shell and KQL.
🎓 Education-only simulation. Your lab is saved in this browser, so you can leave and continue later.
😟 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
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.
Read the video script
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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
| Change | Scope | New revision? |
|---|---|---|
| Image, env vars, CPU/memory, probes, scale rules | Revision (properties.template) | Yes |
| Ingress, traffic weights, secrets, registries, revision mode, Dapr | Application (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 Multiple mode
revision set-mode --mode multiple.
-
2 New revision
update --image 1.5.0 creates ragapi--v15.
-
3 Split
ingress traffic set sends 80/20.
-
4 Decide
100% to v15, or 100% back to v14.
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
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.
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.
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.What creates a new revision?Show
A change to the template, such as image, env vars or scale rules.
-
2.What is the default revision mode?Show
Single.
-
3.Which command switches to multiple revision mode?Show
az containerapp revision set-mode --mode multiple
-
4.Which command splits traffic between revisions?Show
az containerapp ingress traffic set
-
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
Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges.