There is perhaps another way to do this, but I wasn’t able to find any documentation about configuring an Azure App Service or Azure Function here. After I created the APIM and API hosted on App Service I received a HTTP/1.1 404 Not Found when I tried testing it from the APIM portal.
Figure 1, APIM mapped to App Service 404 and 401
When I tested it from a browser I received the following.
"message": "Access denied due to missing subscription key. Make sure to include subscription key when making requests to an API."
When I tested it from Postman and sent along the Ocp-Apim-Subscription-Key and value, I again received the HTTP/1.1 404 Not Found response, so at least we are consistent.
When you create the API for a Web App, you are asked to provide the App Service name. I assume this routes to the root directory of the App, but I added an API URL suffix which was the same as the path I wanted to route the request to on my App. Since it was an API, there is nothing listening on the root, so I suppose that is where the 404 is coming from. I simply updated the Service URL to the endpoint using the URL instead of the Azure resource.
Figure 2, APIM mapped to App Service 404 and 401
Then I was able to used Postman the successfully trigger the App Service via the APIM endpoint.
Figure 3, APIM mapped to App Service 404 and 401