Introduction
Microservices have become a popular architecture for modern applications because they allow teams to develop, deploy, and scale services independently. However, managing microservices often requires container orchestration platforms such as Kubernetes, which can introduce additional complexity.
Many organizations want the benefits of containers without the operational overhead of managing Kubernetes clusters.
This is where Azure Container Apps comes in.
Azure Container Apps is a fully managed service that enables developers to deploy containerized applications and microservices without managing Kubernetes infrastructure. It handles scaling, networking, service discovery, and infrastructure management behind the scenes.
In this tutorial, you'll learn what Azure Container Apps is, how it works, and how to deploy your first microservice.
What Is Azure Container Apps?
Azure Container Apps is a serverless container platform from Microsoft Azure that allows developers to run containerized applications without managing servers or Kubernetes clusters.
It provides:
Automatic scaling
Built-in HTTPS
Service discovery
Traffic management
Container deployment
Event-driven scaling
Developers focus on application code while Azure manages the underlying infrastructure.
Why Use Azure Container Apps?
Azure Container Apps offers several advantages for modern development teams.
Simplified Operations
No need to:
Automatic Scaling
Applications automatically scale based on:
HTTP requests
CPU usage
Memory consumption
Event-driven triggers
Cost Efficiency
You only pay for resources consumed by running applications.
Faster Deployment
Developers can deploy applications quickly without learning Kubernetes concepts.
Understanding the Architecture
A typical Azure Container Apps architecture looks like this:
Client
↓
Azure Container Apps
↓
Microservices
↓
Database / Storage
Each microservice runs inside its own container and communicates securely with other services.
Common Use Cases
Azure Container Apps is ideal for:
Microservices
REST APIs
Background jobs
Event-driven applications
Internal business services
Containerized web applications
It is especially useful for teams that want container benefits without Kubernetes management.
Prerequisites
Before starting, ensure you have:
Login to Azure:
az login
Verify your subscription:
az account show
Create a Resource Group
Create a resource group to organize resources.
az group create \
--name demo-rg \
--location eastus
The resource group acts as a container for Azure resources.
Create a Container App Environment
Container Apps require an environment.
az containerapp env create \
--name demo-env \
--resource-group demo-rg \
--location eastus
The environment provides networking and runtime services for applications.
Build a Simple Microservice
Create a simple API using Node.js.
Example:
const express = require("express");
const app = express();
app.get("/", (req, res) => {
res.send("Hello from Azure Container Apps");
});
app.listen(3000);
Save the file as:
server.js
Create a Dockerfile
Containerize the application.
FROM node:22
WORKDIR /app
COPY . .
RUN npm install
EXPOSE 3000
CMD ["node", "server.js"]
This Dockerfile packages the application into a container image.
Build the Docker Image
Build the image locally.
docker build -t my-api .
Verify the image.
docker images
Push Image to Azure Container Registry
Create a registry.
az acr create \
--resource-group demo-rg \
--name mycontainerregistry \
--sku Basic
Login to the registry.
az acr login \
--name mycontainerregistry
Tag the image.
docker tag my-api \
mycontainerregistry.azurecr.io/my-api:v1
Push the image.
docker push \
mycontainerregistry.azurecr.io/my-api:v1
The image is now available for deployment.
Deploy the Container App
Create the container app.
az containerapp create \
--name my-api \
--resource-group demo-rg \
--environment demo-env \
--image mycontainerregistry.azurecr.io/my-api:v1 \
--target-port 3000 \
--ingress external
Azure provisions the infrastructure automatically.
Access the Application
Retrieve the application URL.
az containerapp show \
--name my-api \
--resource-group demo-rg
The output includes a public endpoint.
Example:
https://my-api.azurecontainerapps.io
Opening the URL displays:
Hello from Azure Container Apps
Your microservice is now running in Azure.
Understanding Auto Scaling
One of the biggest benefits of Azure Container Apps is automatic scaling.
Scaling can occur based on:
Incoming requests
CPU utilization
Memory usage
Queue messages
Example configuration:
--min-replicas 1
--max-replicas 10
Azure automatically adjusts resources according to demand.
Deploying Multiple Microservices
Most applications consist of multiple services.
Example architecture:
Frontend Service
↓
User Service
↓
Order Service
↓
Database
Each service can be deployed as an independent container app.
Benefits include:
Independent scaling
Separate deployments
Fault isolation
Improved maintainability
Service-to-Service Communication
Container Apps support internal communication.
Example:
user-service
order-service
payment-service
Services can securely communicate without exposing endpoints publicly.
This simplifies microservice architectures.
Managing Environment Variables
Applications often require configuration values.
Example:
--env-vars \
DATABASE_URL=mydatabase \
API_KEY=myapikey
Environment variables help separate configuration from application code.
Secrets Management
Avoid storing sensitive data directly in code.
Store secrets such as:
Database passwords
API keys
Connection strings
Authentication tokens
Azure provides secure secret management capabilities for Container Apps.
Monitoring Applications
Monitoring is critical for production workloads.
Azure provides:
Application Insights
Metrics
Logs
Alerts
Useful metrics include:
Request count
Response time
Error rates
CPU usage
Memory consumption
Monitoring helps maintain application reliability.
Traffic Splitting and Revisions
Azure Container Apps supports application revisions.
Example scenario:
Version 1 → 80% Traffic
Version 2 → 20% Traffic
Benefits include:
Canary deployments
A/B testing
Safer releases
Easy rollbacks
This feature helps reduce deployment risks.
Azure Container Apps vs Kubernetes
| Feature | Azure Container Apps | Kubernetes |
|---|
| Cluster Management | Not Required | Required |
| Complexity | Low | High |
| Auto Scaling | Built-In | Configurable |
| Learning Curve | Easy | Steep |
| Infrastructure Management | Managed | User Managed |
| Microservices Support | Excellent | Excellent |
Azure Container Apps is ideal for teams seeking simplicity.
Best Practices
When deploying microservices using Azure Container Apps:
Keep containers lightweight.
Use environment variables for configuration.
Enable monitoring and logging.
Configure proper scaling limits.
Store secrets securely.
Use health checks.
Implement API authentication.
Deploy services independently.
These practices improve reliability and maintainability.
Common Mistakes to Avoid
Developers often encounter these issues:
Creating oversized containers
Hardcoding secrets
Ignoring monitoring
Incorrect scaling settings
Combining too many services into one container
Not implementing health checks
Avoiding these mistakes helps ensure successful deployments.
Real-World Use Cases
Azure Container Apps is commonly used for:
E-Commerce Platforms
Independent product, payment, and order services.
SaaS Applications
Scalable APIs and backend services.
Event Processing
Message-driven workloads.
Internal Business Applications
Department-specific services and workflows.
AI-Powered Applications
Inference APIs and AI microservices.
Its flexibility makes it suitable for many modern workloads.
Conclusion
Azure Container Apps provides a powerful way to deploy microservices without managing Kubernetes infrastructure. By handling scaling, networking, security, and infrastructure management automatically, it allows developers to focus on building applications instead of operating clusters.
Whether you're deploying APIs, background services, event-driven workloads, or full microservice architectures, Azure Container Apps offers a simpler path to running containerized applications in production.
For teams that want the benefits of containers without the complexity of Kubernetes, Azure Container Apps is an excellent solution.