Connect to a container console in Azure Container Apps
Connecting to a container's console is useful when you want to troubleshoot your application inside a container. Azure Container Apps lets you connect to a container's console using the Azure portal or the Azure CLI.
Azure portal
To connect to a container's console in the Azure portal, follow these steps.
- Select Console in the Monitoring menu group from your container app page in the Azure portal.
- Select the revision, replica and container you want to connect to.
- Choose to access your console via bash, sh, or a custom executable. If you choose a custom executable, it must be available in the container.
Azure CLI
Use the az containerapp exec
command to connect to a container console. Select Ctrl-D to exit the console.
For example, connect to a container console in a container app with a single container using the following command. Replace the <placeholders> with your container app's values.
az containerapp exec \
--name <ContainerAppName> \
--resource-group <ResourceGroup>
To connect to a container console in a container app with multiple revisions, replicas, and containers include the following parameters in the az containerapp exec
command.
Argument | Description |
---|---|
--revision |
The revision names of the container to connect to. |
--replica |
The replica name of the container to connect to. |
--container |
The container name of the container to connect to. |
You can get the revision names with the az containerapp revision list
command. Replace the <placeholders> with your container app's values.
az containerapp revision list \
--name <ContainerAppName> \
--resource-group <ResourceGroup> \
--query "[].name"
Use the az containerapp replica list
command to get the replica and container names. Replace the <placeholders> with your container app's values.
az containerapp replica list \
--name <ContainerAppName> \
--resource-group <ResourceGroup> \
--revision <RevisionName> \
--query "[].{Containers:properties.containers[].name, Name:name}"
Connect to the container console with the az containerapp exec
command. Replace the <placeholders> with your container app's values.
az containerapp exec \
--name <ContainerAppName> \
--resource-group <ResourceGroup> \
--revision <RevisionName> \
--replica <ReplicaName> \
--container <ContainerName>
Feedback
Submit and view feedback for