Interview Prep/Azure/Network Connectivity Errors

Application Gateway returns `502 Bad Gateway` and backend health shows Unhealthy.

IntermediateTroubleshootingNetwork Connectivity Errors
Answer

Likely causes → Probe path returns non-2xx/3xx, NSG on backend blocks App Gateway subnet, TLS mismatch (backend cert CN doesn't match host name), wrong port, or backend actually down.

Diagnose →

az network application-gateway show-backend-health -g rg -n agw-shop \
  --query "backendAddressPools[].backendHttpSettingsCollection[].servers[].{ip:address, health:health, log:healthProbeLog}" -o table

Fix →

  1. Point the custom probe at a real health endpoint with correct host header
  2. Allow traffic from the App Gateway subnet on the backend port
  3. For HTTPS backends, set the correct host name or trusted root certificate

Prevent → Dedicated /healthz endpoints and probes in IaC.

Azure All Azure questions Roadmap: Azure core services

More on Network Connectivity Errors