☁ Azure Container Guide

7. Troubleshooting and cleanup

View logs

# App Service
az webapp log tail --resource-group $RG --name $APP_NAME

# Container Apps
az containerapp logs show --name ca-containerdemo --resource-group $RG --follow
az containerapp logs show --name ca-containerdemo --resource-group $RG --type system

Common problems

SymptomLikely causeFix
App Service shows "Application Error" or times out on start Azure is probing the wrong port Set WEBSITES_PORT=8080 to match ASPNETCORE_HTTP_PORTS.
Container Apps returns 502/503 or never becomes ready --target-port does not match the container Update ingress target port to 8080 and redeploy.
Image pull fails (unauthorized) Missing AcrPull role or role not propagated yet Check the role assignment, wait a few minutes, then restart.
"exec format error" in logs Image built for ARM64 but host is AMD64 Rebuild with --platform linux/amd64 or use az acr build.
Redirect loop or http links behind HTTPS Forwarded headers not configured Set ASPNETCORE_FORWARDEDHEADERS_ENABLED=true as shown in step 3.
First request is slow Cold start (scale to zero, or Always On disabled) Set min replicas to 1, or enable Always On.
App cannot find configuration Settings only exist on your machine Provide settings via app settings / environment variables / Key Vault.

Production checklist

Clean up

Deleting the resource group removes everything created in this guide, stopping any charges:

az group delete --name $RG --yes --no-wait