Publish Azure App Services with Application Gateway

We recently configured this scenario to facilitate some internal testing. The below screen shots show the main areas to configure to get 2 or more back-end App Services hosting websites, Apis, etc, published via Azure Application Gateway and a single host name. This can be configured in various ways, and there are many other ways to do effect this functionality, e.g. API management. However, for our purposes the below worked ok for the situation.

Below I assume we already have 2 App services and the Application Gateway (AGW) configured with default settings. Note that if you want the gateway with firewall (WAF) to choose the appropriate SKU.

Once this is done, go to the Settings of the AGW add a back-end pool. Because the back-ends are App service, the drop down list for back-end targets will be populated for you. You can add both App services to the one pool, one pool for each, or both, whatever your requirements. For this follow the last option.

Next you create an HTTP setting for HTTPS. The settings we used are shown below. Note that you can create this setting without the custom probe down the bottom, we’ll add this next.

Next add the Health Probe, our settings are below. Note that you can associate the probe with the HTTPS settings we configured in previous step.

Then we created the Listener for HTTPS on the AGW front-end public IP. We added a public certificate with the host name that we wanted. Note the Rule shown in the below grab will be created in the next step.

Then you tie all these elements together with a rule. First select the HTTPS listener.

Then for the back end targets, select the back end pool and HTTP setting, and you can also then select different paths which can route to different back end pools as shown.

The last thing would be to make sure that there is a CNAME record in DNS for your certificate name pointing to the DNS name of the AGW.

Then when you browse to https://example.domain.com/app2/…. you will directed to one of the Azure App service backends, and https://example.domain.com/app3/….will route to the other App Service.