How to deploy a serverless container with Azure Container Apps
Deploy a containerized service to Azure Container Apps with scale-to-zero, ingress, KEDA-based scale rules, and revision-based canary rollouts.
Azure Container Apps runs containers serverlessly on top of Kubernetes and KEDA without exposing that complexity. It supports scale-to-zero, event-driven scaling, and revision-based rollouts, making it a strong middle ground between Azure Functions and full AKS.
Prerequisites
- An Azure subscription and the Azure CLI.
- A container image in a registry (ACR or Docker Hub).
Steps
1. Install the extension
az extension add --name containerapp --upgrade
az provider register --namespace Microsoft.App
2. Create an environment
The environment is a secure boundary that apps share for networking and logging:
az containerapp env create --name app-env --resource-group rg-app --location eastus
3. Deploy the app
az containerapp create --name web --resource-group rg-app --environment app-env \
--image myregistry.azurecr.io/web:1 --target-port 8080 --ingress external
4. Configure ingress
External ingress assigns a public HTTPS URL with a managed certificate. Use internal ingress for service-to-service calls that should not be public.
5. Set scale rules
Scale on HTTP concurrency or a queue depth, and allow scale to zero:
az containerapp update --name web --resource-group rg-app \
--min-replicas 0 --max-replicas 10 --scale-rule-name http --scale-rule-http-concurrency 50
6. Roll out a revision
Each config or image change creates a revision. Run multiple revisions and split traffic for canary releases:
az containerapp ingress traffic set --name web --resource-group rg-app \
--revision-weight latest=20 <previous-revision>=80
Verification
Call the app's ingress URL and confirm a response. Stop sending traffic and confirm replicas drop to zero after the cooldown (no billing while idle). Deploy a new image, split traffic, and confirm both revisions serve in the expected proportion.
Next Steps
Add Dapr for service discovery and pub/sub, bind secrets from Key Vault, and connect to a private VNet for backend access.
Prerequisites
- Azure subscription
- Azure CLI installed
- A container image
Steps
- 1Install the extension
- 2Create an environment
- 3Deploy the app
- 4Configure ingress
- 5Set scale rules
- 6Roll out a revision