Skip to content

Latest commit

 

History

History
140 lines (95 loc) · 4.9 KB

File metadata and controls

140 lines (95 loc) · 4.9 KB
title Tutorial: Deploy your first container app
description Deploy your first application to Azure Container Apps.
services container-apps
author craigshoemaker
ms.service azure-container-apps
ms.topic tutorial
ms.date 05/05/2025
ms.author cshoe
ms.custom mode-api, devx-track-azurecli, devx-track-azurepowershell
ms.devlang azurecli

Tutorial: 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 tutorial, you create a secure Container Apps environment and deploy your first container app.

Note

You can also deploy this app using the az containerapp up by following the instructions in the Quickstart: Deploy your first container app with containerapp up article. The az containerapp up command is a fast and convenient way to build and deploy your app to Azure Container Apps using a single command. However, it doesn't provide the same level of customization for your container app.

Prerequisites

[!INCLUDE container-apps-create-cli-steps.md]

[!INCLUDE container-apps-set-environment-variables.md]

[!INCLUDE container-apps-create-resource-group.md]

[!INCLUDE container-apps-create-environment.md]

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/k8se/quickstart:latest \
  --target-port 80 \
  --ingress external \
  --query properties.configuration.ingress.fqdn

Note

Make sure the value for the --image parameter is in lower case.

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

$ImageParams = @{
    Name = 'my-container-app'
    Image = 'mcr.microsoft.com/k8se/quickstart:latest'
}
$TemplateObj = New-AzContainerAppTemplateObject @ImageParams
$EnvId = (Get-AzContainerAppManagedEnv -EnvName $ContainerAppsEnvironment -ResourceGroupName $ResourceGroupName).Id

$AppArgs = @{
    Name = 'my-container-app'
    Location = $Location
    ResourceGroupName = $ResourceGroupName
    ManagedEnvironmentId = $EnvId
    IdentityType = 'SystemAssigned'
    TemplateContainer = $TemplateObj
    IngressTargetPort = 80
    IngressExternal = $true

}
New-AzContainerApp @AppArgs

Note

Make sure the value for the Image parameter is in lower case.

By setting IngressExternal to $true, you make the container app available to public requests.


Verify deployment

The create command returns the fully qualified domain name for the container app. Copy this location to a web browser.

Get the fully qualified domain name for the container app.

(Get-AzContainerApp -Name $AppArgs.Name -ResourceGroupName $ResourceGroupName).IngressFqdn

Copy this location to a web browser.


The following message is displayed when the container app is deployed:

:::image type="content" source="media/get-started/azure-container-apps-quickstart.png" alt-text="Screenshot of container app web page.":::

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 tutorial.

Caution

The following command deletes the specified resource group and all resources contained within it. If resources outside the scope of this tutorial exist in the specified resource group, they're also deleted.

az group delete --name $RESOURCE_GROUP
Remove-AzResourceGroup -Name $ResourceGroupName -Force

Tip

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

Next steps

[!div class="nextstepaction"] Communication between microservices