Container Apps & KEDA
Environments · containers · revisions · traffic splitting · ingress · secrets · KEDA scale rules
By the tools4free.dev team · Last reviewed November 13, 2026
Practice questions for this topic →
Environments and containers
- A Container Apps environment is a secure boundary around one or more container apps and jobs. Apps in the same environment share the same virtual network and write logs to the same logging destination.
- By default, all apps in an environment send logs to a common Log Analytics workspace.
- Use a single environment for related services, a shared virtual network, Dapr service invocation, or a shared log destination. Use more than one when apps must never share compute resources or must be isolated by team or use (for example test vs. production).
- Environment types: Workload profiles environments (the default) and Consumption only environments (legacy).
- Container Apps supports any Linux-based x86-64 (
linux/amd64) image from any public or private registry, plus optional sidecar and init containers. A crashed container restarts automatically. - The main app and its sidecars are in the
containersarray ofproperties.template; init containers are in theinitContainersarray. Init containers run in the order defined and must complete successfully before the primary container starts. - Several containers in one app share disk and network and the same lifecycle. For most microservices, deploy each service as a separate container app.
- Avoid static image tags such as
latest. Use a unique tag per deployment, such as a Git hash or date and time. - On the Consumption plan, total CPU and memory across all containers must match a listed pair, for example 0.25 vCPU with 0.5Gi, 0.5 with 1.0Gi, 1.0 with 2.0Gi, up to 4.0 with 8.0Gi.
Pulling images from Azure Container Registry
- Define the registry in the
registriesarray ofproperties.configuration.passwordSecretRefnames the secret that holds the password. - To use managed identity instead, enable the identity in the app and assign the
acrPullrole on the registry. Set the registry'sidentityproperty to the resource ID of a user-assigned identity or tosystem. Don't configure a username and password.
Revisions
- Revisions are snapshots of each version of your container app: immutable, versioned, and created automatically (an initial revision on first deployment). By default 100 inactive revisions are kept.
- Revision names are
<CONTAINER_APP_NAME>-<REVISION_SUFFIX>. A suffix uses lower-case alphanumerics or dashes, starts with a letter, ends with an alphanumeric, has no two consecutive dashes and is at most 64 characters.
| Mode | Behavior | Default |
|---|---|---|
| Single | New revisions are provisioned, activated and scaled; traffic moves once all replicas run. If an update fails, traffic stays on the old revision. Old revisions are deprovisioned | Yes |
| Multiple | Several active revisions, traffic splitting, and you choose when to deprovision old ones. Used for blue-green and A/B testing | No |
| Deployment labels (preview) | Names such as dev, staging, prod for revisions; used for traffic splitting and A/B testing | No |
- Zero downtime in single mode: the existing revision isn't deactivated until the new one is ready. Ready means provisioned, scaled to match the previous replica count (within the new min and max), and all replicas passed startup and readiness probes.
- Changing the revision mode doesn't create a new revision.
| Scope | Changes | New revision? |
|---|---|---|
| Revision-scope | Anything in properties.template: revision suffix, container configuration and images, scale rules | Yes |
| Application-scope | Anything in properties.configuration: secret values, revision mode, ingress settings (on/off, traffic splitting rules, labels), private registry credentials, Dapr settings | No; applies to all revisions |
- After you modify secrets, restart the active revisions so they can access them.
- A label gives a revision its own URL. A label applies to only one revision at a time, and keeps the same URL when you move it to another revision. Labels work independently of traffic splitting and are most useful in multiple revision mode.
- Inactive revisions are dormant and aren't charged. Deactivating stops all running replicas.
| Task | Command |
|---|---|
| Update (new revision if revision-scope) | az containerapp update |
| Copy a revision and change settings | az containerapp revision copy |
| Activate / deactivate / restart | az containerapp revision activate / deactivate / restart |
| Set the mode | az containerapp revision set-mode (single or multiple) |
| Add a label | az containerapp revision label add |
Traffic splitting and ingress
- With ingress enabled, all traffic goes to the latest deployed revision by default. Enable multiple revision mode to split traffic between active revisions.
- Split by weight (percentage). The combined weight of all rules must equal 100%. Specify revisions by name (
--revision-weight) or by label (--label-weight). - Example:
az containerapp ingress traffic set --name <APP_NAME> --resource-group <RESOURCE_GROUP> --revision-weight <REVISION_1>=50 <REVISION_2>=50
| Ingress | Reachable from |
|---|---|
| External | Through the environment's inbound IP address, and from other apps in the same environment. Public reachability also depends on the environment's network configuration |
| Internal | Directly only from within the same environment, such as other container apps. Use it for backend services |
- HTTP ingress terminates TLS (always TLS 1.2 or 1.3), supports HTTP/1.1, HTTP/2, WebSocket and gRPC, redirects port 80 to HTTPS on 443 by default, and has a request time-out of 240 seconds.
- You don't need an Azure Load Balancer or public IP address to enable ingress. External TCP ingress is only supported for environments that use a virtual network.
Secrets and environment variables
- Secrets are name/value pairs defined at the application level. The value is set directly or as a reference to a secret in Azure Key Vault. Avoid direct values in production. Revisions can share secrets.
- Key Vault reference: enable a managed identity on the app and grant it the Key Vault Secrets User Azure RBAC role. CLI format:
<SECRET_NAME>=keyvaultref:<KEY_VAULT_SECRET_URI>,identityref:<MANAGED_IDENTITY_ID>. - With no version in the URI the app uses the latest version and retrieves a new one within 30 minutes. A system-assigned identity can't be used with the create command because it doesn't exist until the app is created; use a user-assigned identity.
- Environment variables are set at creation or later by creating a new revision. Pass them as space-separated
key=valueentries with--env-vars. If several share a name, the last one in the list takes effect. - Reference a secret from an environment variable with
secretref:followed by the secret name, for example--set-env-vars <VAR_NAME>=secretref:<SECRET_NAME>. - Mounted as a volume, each secret becomes a file named after the secret; the file contents are the value.
- Before deleting a secret, deploy a new revision that no longer references it.
Changing a secret value is an application-scope change: no new revision is created, so restart the active revisions.
Scaling and KEDA
- Container Apps uses KEDA (Kubernetes Event-driven Autoscaling). KEDA scales on HTTP requests, queue messages, CPU and memory, and event sources such as Azure Service Bus, Azure Event Hubs, Apache Kafka and Redis.
- Adding or editing scale rules creates a new revision.
- Limits per revision: minimum replicas default 0, maximum default 10. Maximum replicas configurable are 1,000. You aren't billed usage charges at zero replicas. Set the minimum to 1 or higher to keep an instance always running.
- If you define more than one scale rule, the app begins to scale once the first condition of any rule is met.
- Without a scale rule the default is HTTP, min 0, max 10. With ingress disabled and no
minReplicasor custom rule, the app scales to zero and has no way of starting back up.
| Rule | Threshold | CLI parameter | Notes |
|---|---|---|---|
| HTTP | concurrentRequests (default 10) | --scale-rule-http-concurrency | Concurrent requests = requests in the past 15 seconds divided by 15. Jobs don't support HTTP rules |
| TCP | concurrentConnections (default 10) | --scale-rule-tcp-concurrency | Not supported in the Azure portal; jobs don't support TCP rules |
| Custom (KEDA scaler) | Scaler type and metadata | --scale-rule-type, --scale-rule-metadata | Any ScaledObject-based KEDA scaler; event-driven jobs use ScaledJob-based scalers |
Authentication for custom rules
- Secrets: create a secret in the app's
secretsarray and use it in the rule'sautharray. CLI:--scale-rule-auth "connection=connection-string-secret". - Managed identity (Queue Storage, Service Bus, Event Hubs and others): use the
identityproperty instead ofauth, set to a user-assigned identity's resource ID orsystem. CLI:--scale-rule-identity. Managed identity isn't supported in the Azure portal. - Service Bus example:
--scale-rule-type azure-servicebus --scale-rule-metadata "queueName=my-queue" "namespace=service-bus-namespace" "messageCount=5". - Set
activeRevisionsModetosinglewhen using non-HTTP event scale rules.
Scale behavior
| Behavior | Value |
|---|---|
| Polling interval | 30 seconds (not used by HTTP and TCP rules) |
| Cool down period | 300 seconds; only applies when scaling in from the final replica to 0 |
| Scale up stabilization window | 0 seconds |
| Scale down stabilization window | 300 seconds |
| Scale up step | 1, 4, 8, 16, 32, ... up to the maximum |
| Scale down step | 100% of replicas that need to shut down |
| Algorithm | desiredReplicas = ceil(currentMetricValue / targetMetricValue) |
- Example: with
messageCount5 and 50 messages,desiredReplicas = ceil(50/5) = 10. KEDA scales tomin(maxReplicaCount, desiredReplicas, max(4, 2*currentReplicaCount)). - Limits: vertical scaling isn't supported, and replica quantities are a target amount, not a guarantee. Scaling to zero isn't supported with Dapr actors.
- In multiple revision mode, a new scale trigger creates a new revision, and the old revision stays available with the old rules.
CLI and PowerShell
| Task | Azure CLI | PowerShell |
|---|---|---|
| Update an app (new image) | az containerapp update --name <APPLICATION_NAME> --resource-group <RESOURCE_GROUP_NAME> --image <IMAGE_NAME> | - |
| List revisions | az containerapp revision list --name <APPLICATION_NAME> --resource-group <RESOURCE_GROUP_NAME> -o table | - |
| Copy a revision | az containerapp revision copy --name <APPLICATION_NAME> --resource-group <RESOURCE_GROUP_NAME> --cpu 0.75 --memory 1.5Gi | - |
| Activate a revision | az containerapp revision activate --revision <REVISION_NAME> --resource-group <RESOURCE_GROUP_NAME> | - |
| Deactivate a revision | az containerapp revision deactivate --revision <REVISION_NAME> --resource-group <RESOURCE_GROUP_NAME> | - |
| Restart a revision | az containerapp revision restart --revision <REVISION_NAME> --resource-group <RESOURCE_GROUP_NAME> | - |
| Set the revision mode | az containerapp revision set-mode --name <APPLICATION_NAME> --resource-group <RESOURCE_GROUP_NAME> --mode <REVISION_MODE> | - |
| Add a revision label | az containerapp revision label add --revision <REVISION_NAME> --resource-group <RESOURCE_GROUP_NAME> --label <LABEL_NAME> | - |
| Split traffic by revision | az containerapp ingress traffic set --name <APP_NAME> --resource-group <RESOURCE_GROUP> --revision-weight <REVISION_1>=50 <REVISION_2>=50 | - |
| Split traffic by label | az containerapp ingress traffic set --name <APP_NAME> --resource-group <RESOURCE_GROUP> --label-weight <LABEL_1>=80 <LABEL_2>=20 | - |
| Reference a secret in an environment variable | az containerapp update -n <APP NAME> -g <RESOURCE_GROUP_NAME> --set-env-vars <VAR_NAME>=secretref:<SECRET_NAME> | - |
Exam Tips
Tick each tip once you can answer it without looking.
“Change that creates a new revision” → Revision-scope: anything in properties.template (image, container configuration, scale rules, revision suffix). Trap: Application-scope changes (secrets, ingress, revision mode, registry credentials) apply to all revisions and create none.
“Default revision mode” → Single; a failed update leaves traffic on the old revision. Trap: Multiple revision mode is needed for traffic splitting.
“80/20 split between two revisions” → Multiple revision mode, then az containerapp ingress traffic set --revision-weight. Trap: Weights must total 100%. Copying a revision doesn't change traffic.
“Stable test URL you can repoint to another revision” → Revision label. Trap: A label sits on one revision at a time; the revision suffix is part of the revision name, not a movable URL.
“Secret changed but containers still see the old value” → Restart the active revisions. Trap: A secret change is application-scope, so no new revision is created for you.
“Pass a secret to the container as an environment variable” → secretref:<SECRET_NAME> as the value. Trap: Don't copy the secret value into a plain variable.
“Key Vault secret in az containerapp create” → User-assigned identity with keyvaultref: and identityref: and Key Vault Secrets User. Trap: A system-assigned identity doesn't exist until after the app is created.
“Pull from ACR without a password” → Enable a managed identity, assign acrPull, set the registry identity (system or resource ID). Trap: Don't set a username and password with managed identity.
“Backend called only by other apps in the environment” → Internal ingress. Trap: External ingress also exposes the app through the environment's inbound IP.
“Apps that must share network and log destination” → Put them in the same environment. Trap: Use separate environments to isolate teams or test vs. production.
“Image tag for Container Apps deployments” → Unique tag (Git hash, date and time). Trap: Static tags like latest cause caching problems and make troubleshooting hard.
“Scale rule kinds” → HTTP, TCP, or custom (any ScaledObject-based KEDA scaler). Trap: Jobs don't support HTTP or TCP rules; event-driven jobs use ScaledJob-based scalers.
“Defaults without a scale rule” → HTTP rule, min 0, max 10 replicas. Trap: No ingress and no minimum replicas means the app scales to zero and can't start again.
“Secret for a KEDA scaler” → Container Apps secret plus --scale-rule-auth. Trap: Prefer managed identity (--scale-rule-identity, identity property) where supported; it isn't supported in the portal.
“Replicas for a queue length” → desiredReplicas = ceil(currentMetricValue / targetMetricValue) (queue length / messageCount), capped by the maximum and by max(4, 2*currentReplicaCount). Trap: Scale in waits 300 seconds, and only the last replica waits for the 300-second cool down.
“Zero replicas” → No usage charges; the default minimum is 0. Trap: Set the minimum to 1 or higher to keep an instance always running.
“Polling interval does not apply to” → HTTP and TCP scale rules. Trap: It is 30 seconds for custom (KEDA) rules.
Sources
- Update and deploy changes (revisions)
- Manage revisions
- Traffic splitting
- Containers in Azure Container Apps
- Container Apps environments
- Manage environment variables
- Manage secrets
- Ingress overview
- Scaling in Azure Container Apps
- Managed identities in Azure Container Apps
Checked against Microsoft Learn on November 13, 2026.