I have set up a new application Gateway following the MS document. I have configured the back end pool .it is connected to an App Service via FQDN. Somehow I receive 502 immediately every time I browse to the application gateway. Browsing to the website directly works with no issues .
I have resolved this issue. Here is the solution.
If you have web apps in your backend pools you CAN'T set up the health probes via Azure portal.
You need to set them up via resource templates or Powershell. The key is that you need to leave the host field empty and set
-PickHostNameFromBackendAddress
property.The two lines below did the magic to make the 502s go away