DEV Community

Siri Varma Vegiraju
Siri Varma Vegiraju

Posted on

Setting up Azure Container Apps and Dapr

Getting Started with Azure Container Apps and Dapr

Azure Container Apps is a serverless container platform that enables you to deploy microservices without managing complex infrastructure. When combined with Dapr (Distributed Application Runtime), it unlocks powerful capabilities like service invocation, pub/sub messaging, state management, and more—ideal for building resilient, cloud-native apps.

Prerequisites

  • Azure CLI
  • Dapr CLI
  • A GitHub repo or container image (e.g., from Docker Hub)
  • Azure Subscription

Step 1: Enable Azure CLI Extensions

Install the required extensions:

az extension add --name containerapp --upgrade
az provider register --namespace Microsoft.App
az provider register --namespace Microsoft.OperationalInsights
Enter fullscreen mode Exit fullscreen mode

Step 2: Create a Resource Group and Environment

az group create --name dapr-app-rg --location westus

az containerapp env create \
  --name dapr-env \
  --resource-group dapr-app-rg \
  --location westus
Enter fullscreen mode Exit fullscreen mode

Step 3: Deploy a Container App with Dapr Enabled

Deploy a sample app with Dapr sidecar:

az containerapp create \
  --name dapr-service \
  --resource-group dapr-app-rg \
  --environment dapr-env \
  --image ghcr.io/dapr/samples/hello-k8s-node:latest \
  --target-port 3000 \
  --ingress external \
  --enable-dapr \
  --dapr-app-id nodeapp \
  --dapr-app-port 3000
Enter fullscreen mode Exit fullscreen mode

--enable-dapr deploys the Dapr sidecar
--dapr-app-id is used for service invocation


Step 4: Test Dapr Service Invocation

To invoke the service from another app or tool:

curl http://<container-app-url>/ \
  -H "dapr-app-id: nodeapp"
Enter fullscreen mode Exit fullscreen mode

Step 5: Add Pub/Sub or State Store (Optional)

Attach a pub/sub component or state store by uploading a Dapr component YAML file to your Container App environment via the Azure Portal or Azure CLI. For example, use Azure Storage, Service Bus, or Redis as backends.


Summary

By enabling Dapr in Azure Container Apps, you can focus on building scalable microservices without worrying about infrastructure. You get out-of-the-box service discovery, retries, pub/sub, and state—making your app more robust and cloud-native.

Top comments (0)