While preparing and recording a set of new lectures and labs on Azure Container Apps for my Docker & Kubernetes on Azure course, I noticed that the deployment would sometimes fail. Using the Portal, the Container App environment would be visible along with the Logs Analytics workspace but the Container App would fail saying that the environment creation failed. But wait! I can see it. Something wrong here.
If I would wait for a moment, and try to deploy a Container App in that environment, it would work. Hummm.
Using the Azure CLI, I sometimes got the same error so I took a closer look at the output of the containerapp env create command.
az containerapp env create -n managedEnvironment-lab7 -g ca-lab7 --location eastus2
Ah! Turns out that when this happens, the environment provisioningState is Waiting (I also sometimes got Failed).
My guess is that sometimes, provisioning a Container Apps environment takes longer than usual and the command next in line, the Container App creation, simply fails.
While it's easy to get the provisioningState value when using the CLI, I haven't seen a way to find it in the Portal. Maybe it's hidden somewhere so let me know in the comments if you found a way to see it in the Portal.
To get the Container App environment provisioningState, use the containerapp env show command:
az containerapp env show -n managedEnvironment-lab7 -g ca-lab7 --query "properties.provisioningState"
To get the provisioningState value using the Container Apps VS Code extension, right-click on the environment and select View Properties.