Quickstart: Deploy your first container app

Azure Container Apps Preview enables you to run microservices and containerized applications on a serverless platform. With Container Apps, you enjoy the benefits of running containers while leaving behind the concerns of manually configuring cloud infrastructure and complex container orchestrators.

In this quickstart, you create a secure Container Apps environment and deploy your first container app.



Begin by signing in to Azure from the CLI. Run the following command, and follow the prompts to complete the authentication process.

az login

Next, install the Azure Container Apps extension to the CLI.

az extension add \
  --source https://workerappscliextension.blob.core.windows.net/azure-cli-extension/containerapp-0.2.0-py2.py3-none-any.whl 

Now that the extension is installed, register the Microsoft.Web namespace.

az provider register --namespace Microsoft.Web

Next, set the following environment variables:


With these variables defined, you can create a resource group to organize the services related to your new container app.

az group create \
  --name $RESOURCE_GROUP \
  --location "$LOCATION"

With the CLI upgraded and a new resource group available, you can create a Container Apps environment and deploy your container app.

Create an environment

An environment in Azure Container Apps creates a secure boundary around a group of container apps. Container Apps deployed to the same environment are deployed in the same virtual network and write logs to the same Log Analytics workspace.

Azure Log Analytics is used to monitor your container app required when creating a Container Apps environment.

Create a new Log Analytics workspace with the following command:

az monitor log-analytics workspace create \
  --resource-group $RESOURCE_GROUP \
  --workspace-name $LOG_ANALYTICS_WORKSPACE

Next, retrieve the Log Analytics Client ID and client secret.

Make sure to run each query separately to give enough time for the request to complete.

LOG_ANALYTICS_WORKSPACE_CLIENT_ID=`az monitor log-analytics workspace show --query customerId -g $RESOURCE_GROUP -n $LOG_ANALYTICS_WORKSPACE --out tsv`
LOG_ANALYTICS_WORKSPACE_CLIENT_SECRET=`az monitor log-analytics workspace get-shared-keys --query primarySharedKey -g $RESOURCE_GROUP -n $LOG_ANALYTICS_WORKSPACE --out tsv`

Individual container apps are deployed to an Azure Container Apps environment. To create the environment, run the following command:

az containerapp env create \
  --resource-group $RESOURCE_GROUP \
  --logs-workspace-id $LOG_ANALYTICS_WORKSPACE_CLIENT_ID \
  --location "$LOCATION"

Create a container app

Now that you have an environment created, you can deploy your first container app. Using the containerapp create command, deploy a container image to Azure Container Apps.

az containerapp create \
  --name my-container-app \
  --resource-group $RESOURCE_GROUP \
  --image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest \
  --target-port 80 \
  --ingress 'external' \
  --query configuration.ingress.fqdn

By setting --ingress to external, you make the container app available to public requests.

Here, the create command returns the container app's fully qualified domain name. Copy this location to a web browser and you'll see the following message.

Your first Azure Container Apps deployment.

Clean up resources

If you're not going to continue to use this application, you can delete the Azure Container Apps instance and all the associated services by removing the resource group.

az group delete \


Having issues? Let us know on GitHub by opening an issue in the Azure Container Apps repo.

Next steps