Your profile

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

Lesson 27 of 47
❮Prev Next❯

Provision and Scale Azure Container Apps

Module 3: Compute ⏱ 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 in a Container Apps environment without you managing Kubernetes. You size each replica with an allowed CPU and memory pair (on the Consumption profile, from 0.25 vCPU / 0.5 Gi to 4 vCPU / 8 Gi, always 2 Gi per vCPU). Scale rules (HTTP, TCP or event-based, such as a queue) add replicas between min replicas and max replicas. With min replicas 0 the app scales to zero when it's idle; CPU and memory rules can't do that. Changing scale settings creates a new revision.

    Simulate it » No Azure account needed

    Exam objective: 3.3.3 Provision a container by using Azure Container Apps. 3.3.4 Manage sizing and scaling for containers, including Azure Container Instances and Azure Container Apps. (Skills measured as of April 17, 2026)

    Simulations

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

    Azure portal: Create a container app, size it, and set its scale rules Size a container app and give it an HTTP scale rule.
    </> 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. Every container app lives in a Container Apps environment: a shared boundary with its own network and Log Analytics workspace.
    3. Size each replica with an allowed CPU and memory pair. 0.5 vCPU with 1 Gi is a good start for an API.
    4. External ingress gives the app a public HTTPS URL. With ingress on and no rule of your own, Container Apps scales on HTTP traffic by default.
    5. Review and Create.
    6. Open Application → Scale. Min replicas 0 means no traffic, no running replicas, no compute bill. Max replicas caps the bill on a busy day.
    7. Add an HTTP scaling rule: one replica per 50 concurrent requests. CPU and memory rules can’t scale to zero; HTTP, TCP and event rules can.
    8. Saving scale settings creates a new revision. Under load it ran 8 replicas, and it’ll scale back to zero when it’s quiet.

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

    😟 THE PROBLEM

    The orders API needs 1 replica at night and 20 on sale day.

    😊 THE SOLUTION

    Run it in Container Apps with an HTTP scale rule and min replicas 0.

    • Idle replicas cost money✓ Scale to zero
    • Sale-day traffic✓ HTTP concurrency rule
    • Runaway bill✓ Max replicas cap
    🛠️ Solved with: Container Apps scale rules

    Start with a question

    How many tills should a shop open?

    A supermarket on a quiet Tuesday morning opens one till. On Saturday afternoon it opens ten, and at 11 PM it closes them all. Nobody plans the exact number in advance: the manager watches the queue.

    Azure Container Apps is that manager for your containers. Each open till is a replica. A scale rule watches the queue (HTTP requests, connections or messages) and opens or closes tills between a minimum and maximum you set. If the minimum is zero, the shop can close completely when nobody’s there.

    Explain it like I’m 10

    The technical explanation

    Provision a container app in the portal

    1. Search Container Apps, select + Create → Container App.
    2. Basics: subscription, resource group, Container app name, region and a Container Apps environment (create one if needed; it brings a Log Analytics workspace for logs).
    3. Container: image source (Azure Container Registry, Docker Hub or another registry), image and tag, Workload profile (Consumption) and CPU and Memory.
    4. Ingress: turn it on for an HTTP app. Accepting traffic from anywhere gives a public URL; Limited to Container Apps Environment keeps it internal. Set the target port your container listens on.
    5. Review + create. Then open Application → Scale to set replicas and rules.
    az containerapp env create -g rg-admin-apps -n cae-contoso-adm -l eastus
    az containerapp create -g rg-admin-apps -n ca-orders-api --environment cae-contoso-adm \
      --image mcr.microsoft.com/k8se/quickstart:latest --ingress external --target-port 80 \
      --cpu 0.5 --memory 1.0Gi --min-replicas 0 --max-replicas 5

    In PowerShell the Az.App module does the same with New-AzContainerAppManagedEnv and New-AzContainerApp, with scale rules built by New-AzContainerAppScaleRuleObject.

    Sizing: CPU and memory per replica

    On the Consumption profile, CPU goes from 0.25 to 4 vCPU in steps of 0.25, and memory must be 2 Gi per vCPU:

    CPUMemory
    0.250.5Gi
    0.51.0Gi
    12.0Gi
    24.0Gi
    48.0Gi

    Need an odd shape, more memory or GPUs? Add a dedicated workload profile to the environment and run the app there. You pay for those machines whether they’re busy or not.

    Scaling: replicas and rules

    SettingDefaultNotes
    Min replicas00 means the app can scale to zero
    Max replicas10Raise it (the platform allows up to 1,000) or lower it to cap cost
    HTTP rule10 concurrent requests per replica when ingress is on and you add no ruleSet your own value, such as 50
    TCP ruleConcurrent TCP connections
    Custom (KEDA)Event sources such as Azure Service Bus, Storage queues or Event Hubs
    CPU / memoryUtilisation-based; can’t scale to zero

    Container Apps checks the rules about every 30 seconds and waits a cool-down of 300 seconds with no load before it scales all the way back to zero.

    az containerapp update -g rg-admin-apps -n ca-orders-api \
      --scale-rule-name http-scale --scale-rule-type http \
      --scale-rule-http-concurrency 50 --min-replicas 0 --max-replicas 10

    With that rule, 400 concurrent requests give 400 ÷ 50 = 8 replicas. 1,000 requests would want 20 but stop at 10, so requests start to queue. That’s the trade-off max replicas gives you: a predictable bill.

    Architect level Revisions are how changes roll out

    The scale section is part of the app’s template, so saving new scale settings creates a new revision. In single revision mode the new one takes all the traffic and the old one is deactivated. In multiple revision mode you can split traffic between revisions, for example 90% and 10%, and roll back by moving the traffic. Ingress, secrets and the registry settings are app-level and don’t create a revision.

    Real-world business scenario

    Retail

    Contoso Retail (fictional)

    The problem
    The orders API ran on three always-on VMs. They idled most nights and still fell over during the monthly flash sale.
    What they used
    Azure Container Apps on the Consumption profile: 0.5 vCPU / 1.0Gi per replica, external ingress, an HTTP scale rule at 50 concurrent requests per replica, min replicas 1 during business hours and 0 overnight through a scheduled update, max replicas 30.
    Why that choice
    Replicas follow real traffic within seconds, the night costs almost nothing, and max replicas stops a bot storm from turning into a surprise bill.
    The result
    The flash sale peaked at 26 replicas with no errors, and the monthly compute bill fell by more than half compared with the VMs.

    When to use it and when not to

    ✓ Use it when…

    • A container API or worker has traffic that rises and falls.
    • You want scale to zero for apps that are idle much of the day.
    • Several small services should share one environment, network and log workspace.

    ✕ Think twice when…

    • A job runs once and stops. Container Instances is simpler.
    • You need direct access to the Kubernetes API or custom controllers. Use AKS.
    • A classic web app needs deployment slots and backups. App Service has them built in.

    ↔ Alternatives to consider

    • Azure Container Instances for run-once jobs with fixed CPU and memory.
    • Azure App Service for web apps with slots, custom domains and backups.
    • Azure Kubernetes Service for full control of a Kubernetes cluster.
    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 AZ-104 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

    You deploy an API to Azure Container Apps. The API must incur no compute charges when it receives no requests and must start automatically when requests arrive.

    Which configuration should you use?

    Question 2

    Question 2 of 5

    You create a container app on the Consumption workload profile. Which CPU and memory combination is valid for each replica?

    Question 3

    Question 3 of 5

    A container app has an HTTP scale rule of 50 concurrent requests per replica, a minimum of 0 replicas and a maximum of 6 replicas. The app receives 500 concurrent requests.

    How many replicas will run?

    Question 4

    Question 4 of 5

    You need to provision a container app by using the Azure portal. Which resource must exist or be created before the container app can run?

    Question 5

    Question 5 of 5 · Select 2

    Which two changes to a container app create a new revision? Each correct answer presents a complete solution.

    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 does "scale to zero" mean in Container Apps?

    Model answer

    When nobody is using the app, Container Apps can stop every replica, so you pay nothing for compute. You allow it by setting min replicas to 0. The next request starts a replica again, with a short delay the first time.

    Intermediate An API should add replicas as traffic grows, up to 20. How do you set that up?

    Model answer

    I'd add an HTTP scale rule with a concurrent requests value, say 50 per replica, set max replicas to 20 and min replicas to 0 or 1 depending on whether a cold start is acceptable. In the CLI that's az containerapp update with --scale-rule-type http, --scale-rule-http-concurrency 50 and --max-replicas 20.

    Experienced developer Why didn't my container app scale to zero with a CPU rule?

    Model answer

    CPU and memory rules need at least one replica running to measure anything, so they can't scale to zero. If scale to zero matters, I'd use an HTTP, TCP or event rule, such as an Azure Service Bus queue scaler, and set min replicas to 0.

    Scenario The create wizard rejects 0.5 vCPU with 4 Gi of memory. Why?

    Model answer

    On the Consumption profile CPU and memory come in fixed pairs: memory is twice the vCPU in Gi. 0.5 vCPU goes with 1 Gi. If the app really needs 4 Gi, I'd pick 2 vCPU with 4 Gi, or move it to a dedicated workload profile.

    Quick revision

    Key points

    • Container apps run inside a Container Apps environment; several apps share it.
    • Consumption sizes go from 0.25 vCPU / 0.5 Gi to 4 vCPU / 8 Gi, always 2 Gi per vCPU.
    • Scale rules can be HTTP, TCP or custom (KEDA event sources). Min and max replicas bound them.
    • Min replicas 0 allows scale to zero. CPU and memory rules can't scale to zero.
    • Max replicas defaults to 10. Changing scale settings creates a new revision.

    Important terminology

    Container Apps environment
    The shared boundary that container apps run in, with its own virtual network and Log Analytics workspace.
    Replica
    One running copy of a container app revision. Scaling adds or removes replicas.
    Revision
    An immutable snapshot of a container app's template. Changing the image, settings or scale rules creates a new one.
    Scale rule
    The trigger that tells Container Apps when to add replicas, such as HTTP concurrency, TCP connections or a KEDA event source.
    Min replicas
    The fewest replicas that run. Zero allows scale to zero.
    Max replicas
    The most replicas that can run, which caps cost on a busy day. The default is 10.
    Workload profile
    The compute an environment offers. Consumption is serverless; dedicated profiles give reserved, larger machines.

    Common mistakes

    • Picking a CPU and memory pair that isn't allowed on Consumption.
    • Using a CPU rule and expecting scale to zero.
    • Forgetting max replicas, so a traffic spike runs up the bill.

    Exam tips

    • "Scale to zero when idle" = min replicas 0 with an HTTP or event rule.
    • "Add a replica per N concurrent requests" = HTTP scale rule.
    • "Limit the maximum cost under load" = set max replicas.

    Five quick revision questions

    1. 1.What is the default maximum number of replicas?Show

      10.

    2. 2.Which memory goes with 1 vCPU on the Consumption profile?Show

      2 Gi.

    3. 3.Can a CPU scale rule scale an app to zero?Show

      No.

    4. 4.What do scale changes create?Show

      A new revision.

    5. 5.Which CLI flag sets HTTP concurrency for a scale rule?Show

      --scale-rule-http-concurrency.

    Official references

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

    Next up: App Service Plans, Scaling and Creating a Web App

    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.