Quickstart: Deploy your first container app
The Azure Container Apps service enables you to run microservices and containerized applications on a serverless platform. With Container Apps, you enjoy the benefits of running containers while you leave 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.
- An Azure account with an active subscription.
- If you don't have one, you can create one for free.
- Install the Azure CLI.
To begin, sign in to Azure. Run the following command, and follow the prompts to complete the authentication process.
Next, install the Azure Container Apps extension for the CLI.
az extension add --name containerapp --upgrade
Now that the current extension or module is installed, register the
Azure Container Apps resources have migrated from the
Microsoft.Web namespace to the
Microsoft.App namespace. Refer to Namespace migration from Microsoft.Web to Microsoft.App in March 2022 for more details.
Microsoft.OperationalInsights provider for the Azure Monitor Log Analytics workspace if you have not used it before.
Next, set the following environment variables:
RESOURCE_GROUP="my-container-apps" LOCATION="canadacentral" CONTAINERAPPS_ENVIRONMENT="my-environment"
With these variables defined, you can create a resource group to organize the services related to your new container app.
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.
To create the environment, run the following command:
az containerapp env create \ --name $CONTAINERAPPS_ENVIRONMENT \ --resource-group $RESOURCE_GROUP \ --location $LOCATION
Create a container app
Now that you have an environment created, you can deploy your first container app. With the
containerapp create command, deploy a container image to Azure Container Apps.
az containerapp create \ --name my-container-app \ --resource-group $RESOURCE_GROUP \ --environment $CONTAINERAPPS_ENVIRONMENT \ --image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest \ --target-port 80 \ --ingress 'external' \ --query properties.configuration.ingress.fqdn
Make sure the value for the
--image parameter is in lower case.
external, you make the container app available to public requests.
create command returns the fully qualified domain name for the container app. Copy this location to a web browser.
The following message is displayed when the container app is deployed:
Clean up resources
If you're not going to continue to use this application, run the following command to delete the resource group along with all the resources created in this quickstart.
The following command deletes the specified resource group and all resources contained within it. If resources outside the scope of this quickstart exist in the specified resource group, they will also be deleted.
Having issues? Let us know on GitHub by opening an issue in the Azure Container Apps repo.