Azure Container Apps is a **serverless container service** that allows you to run **containers** without managing Kubernetes infrastructure.
Azure Container Apps - Complete Guide
What is Azure Container Apps?
Azure Container Apps is a **serverless container service** that allows you to run **containers** without managing Kubernetes infrastructure.
Why Use Azure Container Apps?
- Serverless Containers: No need to manage Kubernetes clusters.
- Auto-Scaling: Scale based on HTTP requests, CPU, or events.
- Secure & Fully Managed: Integrated with Azure services like **Azure Monitor** and **Azure Key Vault**.
- Event-Driven: Supports Azure Event Grid, Service Bus, and more.
- Cost-Efficient: Pay only for resources used.
Key Features of Azure Container Apps
- Runs **any containerized application**.
- Supports **HTTP-based** and **event-driven** workloads.
- Works with **Dapr** for microservices and event-driven applications.
- Integrates with **Azure DevOps & GitHub Actions**.
- Built-in **load balancing and scaling**.
Setting Up Azure Container Apps
Step 1: Install Azure CLI
az login
Step 2: Create a Resource Group
az group create --name MyResourceGroup --location eastus
Step 3: Enable Azure Container Apps Extension
az extension add --name containerapp --upgrade
Step 4: Create an Azure Container Apps Environment
az containerapp env create --name MyContainerEnv --resource-group MyResourceGroup --location eastus
Deploying a Container to Azure Container Apps
Step 1: Deploy a Sample Container
az containerapp create \
--name my-container-app \
--resource-group MyResourceGroup \
--environment MyContainerEnv \
--image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest \
--target-port 80 \
--ingress external \
--query properties.configuration.ingress.fqdn
Step 2: Check the Running Container
az containerapp show --name my-container-app --resource-group MyResourceGroup
Scaling Azure Container Apps
Azure Container Apps supports **automatic scaling** based on CPU, memory, and HTTP requests.
Step 1: Set Up Auto-Scaling
az containerapp update \
--name my-container-app \
--resource-group MyResourceGroup \
--min-replicas 1 \
--max-replicas 5
Step 2: Scale Based on HTTP Requests
az containerapp update \
--name my-container-app \
--resource-group MyResourceGroup \
--scale-rule-name http-scaling \
--scale-rule-type http \
--scale-rule-metadata concurrentRequests=50
Deploying a Custom Docker Image
Step 1: Build a Docker Image
docker build -t myapp:latest .
Step 2: Push to Azure Container Registry (ACR)
az acr create --name MyContainerRegistry --resource-group MyResourceGroup --sku Basic
Step 3: Authenticate with ACR
az acr login --name MyContainerRegistry
Step 4: Push the Image
docker tag myapp:latest MyContainerRegistry.azurecr.io/myapp:latest
docker push MyContainerRegistry.azurecr.io/myapp:latest
Step 5: Deploy the Custom Image
az containerapp update \
--name my-container-app \
--resource-group MyResourceGroup \
--image MyContainerRegistry.azurecr.io/myapp:latest
Monitoring Azure Container Apps
az containerapp logs show --name my-container-app --resource-group MyResourceGroup
Securing Azure Container Apps
- Use **Managed Identity** for authentication.
- Store secrets in **Azure Key Vault**.
- Enable **Private Networking**.
- Use **Azure Policy** to enforce security rules.
Deleting an Azure Container App
az containerapp delete --name my-container-app --resource-group MyResourceGroup --yes
Conclusion
Azure Container Apps provide a **fully managed, scalable, and secure** way to run **containerized applications** in a **serverless environment**.
📌 Next Topic: Azure Blob Storage - Managing Cloud Files