Guide to Azure Container Apps

Vineet Sharma
4 min readJan 30, 2025

--

Introduction

Azure Container Apps is a fully managed service that enables developers to deploy and run containerized applications in a serverless environment. It provides seamless scaling, built-in Dapr (Distributed Application Runtime) integration, and supports microservices architectures, making it an ideal choice for cloud-native applications.

In this blog, we will explore Azure Container Apps in-depth, covering its architecture, key features, deployment strategies, scaling mechanisms, security best practices, monitoring techniques, and real-world use cases.

1. Understanding Azure Container Apps

1.1 What is Azure Container Apps?

Azure Container Apps is a managed Kubernetes-based service that allows you to run containerized applications without having to manage Kubernetes clusters. It provides serverless compute for microservices and application containers.

1.2 Key Features

  • Serverless Containers: No need to manage Kubernetes clusters; Azure takes care of the infrastructure.
  • Auto-scaling: Scale applications dynamically based on HTTP traffic, CPU, memory, or events.
  • Integrated Dapr Support: Enables building distributed applications using service-to-service calls, state management, and pub/sub messaging.
  • Ingress and Routing: Built-in support for ingress traffic, including external and internal endpoints.
  • Authentication and Authorization: Seamless integration with Azure Active Directory (AAD), managed identities, and OAuth.
  • Observability and Monitoring: Integration with Azure Monitor, Application Insights, and Log Analytics.

2. Architecture of Azure Container Apps

Azure Container Apps abstracts Kubernetes complexity while providing flexibility for developers. The architecture includes:

2.1 Key Components

  • Container Apps: The core unit where containers run.
  • Environment: A logical boundary containing multiple Container Apps, sharing networking, scaling rules, and observability settings.
  • Ingress Controller: Routes external traffic to containerized workloads.
  • Dapr Runtime: Built-in support for state management, pub/sub messaging, and service discovery.
  • Azure Monitor Integration: Enables logging, metrics, and diagnostics.

2.2 Comparison with Other Azure Container Services

Feature Azure Container Apps Azure Kubernetes Service (AKS) Azure App Service Azure Functions Compute Model Serverless Kubernetes-based PaaS Event-driven Scaling Auto-scale Manual/Auto Auto Auto Complexity Low High Medium Low Best for Microservices, APIs, Background Jobs Enterprise Kubernetes Workloads Web Apps & APIs Event-driven Apps

3. Deploying an Azure Container App

3.1 Prerequisites

Before deploying, ensure you have:

  • An Azure subscription
  • Azure CLI installed (az command-line tool)
  • A Docker image stored in Azure Container Registry (ACR) or Docker Hub

3.2 Steps to Deploy a Container App

Step 1: Create a Resource Group

az group create --name myResourceGroup --location eastus

Step 2: Create an Azure Container Apps Environment

az containerapp env create --name myContainerAppEnv --resource-group myResourceGroup --location eastus

Step 3: Deploy a Container App

az containerapp create --name myapp --resource-group myResourceGroup --environment myContainerAppEnv --image myacr.azurecr.io/myimage:v1 --target-port 80 --ingress external

Step 4: Retrieve the Application URL

az containerapp show --name myapp --resource-group myResourceGroup --query properties.configuration.ingress.fqdn --output tsv

4. Scaling Azure Container Apps

4.1 Horizontal Scaling (KEDA)

Azure Container Apps uses KEDA (Kubernetes Event-Driven Autoscaling) to scale based on:

  • HTTP requests
  • CPU/memory utilization
  • Event sources like Azure Queue, Kafka, or Redis

Example: Scale Based on CPU Utilization

az containerapp update --name myapp --resource-group myResourceGroup --set scale.minReplicas=1 scale.maxReplicas=10 scale.rules="[{\"name\":\"cpu-rule\",\"metricResourceType\":\"cpu\",\"metricTargetValue\":\"80\"}]"

4.2 Traffic Splitting and Revisions

  • Supports rolling updates and blue-green deployments.
  • Example: Split traffic between two revisions.
az containerapp ingress traffic set --name myapp --resource-group myResourceGroup --revision-weight latest=50 previous=50

5. Securing Azure Container Apps

5.1 Authentication and Authorization

  • Azure AD Integration: Secure access with OAuth tokens.
  • Managed Identities: Access Azure services without credentials.
  • Network Isolation: Deploy in a private VNet.

Example: Enable Azure AD Authentication

az containerapp auth update --name myapp --resource-group myResourceGroup --identity system

5.2 Security Best Practices

  • Use private container registries.
  • Scan images for vulnerabilities.
  • Limit ingress exposure to internal use where necessary.

6. Monitoring and Logging

6.1 Azure Monitor Integration

  • Container Insights: Track CPU, memory, and network usage.
  • Log Analytics: Query logs with Kusto Query Language (KQL).
  • Alerts: Set up notifications for performance issues.

Example: Enable Log Analytics

az monitor diagnostic-settings create --resource myapp --name mylog --workspace myLogAnalyticsWorkspace

7. Real-World Use Cases

7.1 Microservices Architecture

Azure Container Apps is an excellent choice for microservices-based applications due to:

  • Built-in Dapr support
  • Scalability and resilience

7.2 API and Backend Services

  • Deploy RESTful APIs or gRPC services.
  • Scale APIs based on request load.

7.3 Event-Driven Processing

  • Process Azure Event Hub, Kafka, or Service Bus messages.
  • Use KEDA-based auto-scaling for efficiency.

8. Advanced Topics

8.1 CI/CD with Azure DevOps

  • Automate deployments with Azure Pipelines.
  • Implement blue-green and canary releases.

8.2 Custom Networking

  • Deploy container apps in private networks.
  • Integrate with Azure Application Gateway or API Management.

Conclusion

Azure Container Apps provide a robust, serverless container solution that simplifies deploying and scaling containerized workloads. With built-in Dapr integration, auto-scaling, and security features, it is a great choice for modern cloud-native applications.

Would you like to explore more hands-on examples? Let us know your thoughts in the comments!

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response