Azure  

How to Deploy Container to Azure Container Apps using Azure CLI?

In this article, Azure Cloud Shell (Azure CLI) is used to deploy containerized application to Azure Container Apps. Azure Container Apps service allows to run microservices and containerized applications on the serverless platform. Container Apps main benefit is to run the containers with ought concerns to manually configuring the cloud infrastructure and complex container coordinators. After this exercise one will be able to create container app environment, deploy a container, and verify running application in Azure.

Following tasks are performed:

  • Create resource

  • Create container apps environment

  • Deploy container app

  • Verify running container app

  • Clean up resources

Create Resource Group and Prepare Azure Environment

First step is to create resources in Azure and prepare the Azure environment using Azure CLI .Azure CLI is a free Bash shell which can be run directly within the Azure portal. It is preinstalled and configured within an account.

Create Resource Group

  • Click Cloud Shell button on the menu bar at the top right side of the Azure portal.

    Cloud Shell button
  • It will launch an interactive shell which can be used to run the steps outlined in this article. Select a Bash environment. To use code editor go to Settings menu in cloud shell toolbar and than select Go to Classic version.

  • Create Resource Group - Resource group is a logical container used to hold related resources. It includes all resources which are required to manage as a group. az group create command creates a resource group. If a resource group is already created and exists then this step can be omitted and it can be use in next steps.

  • Syntax

az group create \ 
     --name <resource-group> \ 
     --location <location>
  • Example

az group create \ 
     --name myResourceGroup1 \ 
     --location eastus2 
  • eastus2 is location code instead of it one can use their nearest region location.

  • az account list-locations command gives complete list of available locations.

az account list-locations
az account list-locations --query "[*].name"
az account list-locations --query "[*].name" --out tsv | sort

Prepare Azure Environment

Let’s upgrade latest version of Azure Container Apps extension for the installed CLI and then register required two namespaces one by one as following.

  • Upgrade Azure Container Apps extension - az extension add command is used to upgrade latest version of Azure Container Apps extension for the installed CLI.

az extension add \
     --name containerapp 
     --upgrade
  • Register namespaces - Microsoft.App and Microsoft.OperationalInsights are two namespaces which needs to be registered for the Azure Container Apps. az provider register command is used to register namespaces as like below.

az provider register --namespace Microsoft.App
az provider register --namespace Microsoft.OperationalInsights
  • Both registration commands will take few minutes to complete the registration process.

Create Container Apps Environment

In Azure Container Apps an environment is used to create secure boundary around group of container apps. az containerapp env create command is used to create an environment.

az containerapp env create \
    --name myContainerEnv1 \
    --resource-group myResourceGroup1 \
    --location eastus2 

Deploy Container App

Once an environment is created successfully next task is deploy container app. az containerapp create command is used to deploy a container image to Azure environment.

az containerapp create \
     --name my-container-app1 \
     --resource-group myResourceGroup1 \
     --environment myContainerEnv1 \
     --image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest \
     --target-port 80 \
     --ingress 'external' \
     --query properties.configuration.ingress.fqdn

Here, --ingress 'external' setting is used to allow application accessible from public requests.

Output: Command execution will take few minutes to complete the operation process and will return fully qualified domain name for container application.

Verify Running Container App

Azure CLI

Once container app created successfully next task is to verify the container app is running properly or not using az containerapp show command as following. It shows the container’s build status.

az containerapp show \
     --name my-container-app1 \
     --resource-group myResourceGroup1 \
     --query "{FQDN:ipAddress.fqdn,ProvisioningState:provisioningState}" \
     --out table 

Output: It displays fully qualified domain name (FQDN) of the container along with it’s state.

FQDNProvisioningState
my-container-app1.eastus2.azurecontainer.ioSucceeded

Browser

One can access container's FQDN from a browser as below. This will be available only if ProvisioningState is Succeeded for the created container.

FQDN from a browser

Pull container app logs

az containerapp logs command is used to pull out container app logs. This is used during an application execution troubleshooting. The output displays the container app’s logs and it shows HTTP GET requests generated while viewed the application in browser.

az containerapp logs \
     --name my-container-app1 \
     --resource-group myResourceGroup1 

Output

listening on port 80
::ffff:10.242.254.51 - - [12/Nov/2025:11:10:35 +0000] "GET / HTTP/1.1" 304 - "-" ...
::ffff:10.242.254.51 - - [15/Nov/2025:12:30:10 +0000] "GET / HTTP/1.1" 304 - "-" ...
…

Clean up resources

Once finished the exercise it’s recommended to delete cloud resources are being created to avoid the unnecessary resource usage and any future costs. Deleting a resource group will delete all resources contained within it. Perform following steps one by one in to Azure Portal to clean up resources:

  • Navigate to resource group which is being created here and view it’s contents.

  • Delete resource group selection from the toolbar.

  • Choose resource group name and then follow next directions to delete resource group and all the resources it contains.

One can also clean up resources using Azure CLI as following:

Delete container app - az containerapp delete command is used to remove container app.

az containerapp delete \
     --name my-container-app1 \
     --resource-group myResourceGroup1 

Delete resource group - az group delete command is used to remove resource group, container registry, and container images, etc.

az group delete \
     --name myResourceGroup1

Summary

This article described how to create container application environment, deploy the container and verify running app in Azure using Azure CLI. Following table summarizes the key commands used in this article:

  • Create resource group: az group create

  • Create container app environment: az containerapp env create

  • Deploy container app: az containerapp create

  • Verify running container app: az containerapp show

  • Pull container app logs: az containerapp logs

  • Delete container app: az containerapp delete

  • Delete resource group: az group delete