In this post, we will look at how to add Azure App Insights into an App Service.
Log into the Azure portal at https://portal.azure.com/ and select your App Service, then go to the Application Insights menu option. Click Turn on Application Insights:
We can set a few other settings here. Let’s click Apply with the defaults:
We see “This will restart the site. Do you want to continue?”. Click Yes:
App Insights should now be set up. We get a link to View Application Insights data. Let’s click it:
This takes us to the App Insights that we created. Note we have an Instrumentation Key, Connection String and some metrics on the Overview tab, including Failed Requests, Server Response Time, Server Requests and Availability:
Let’s create a Postman request to call our API. We get a response back. Let’s run this a few times:
Now in App Insights, we can see the requests coming through:
And clicking on the Performance tab shows us more details on the requests:
Let’s send through a request that will fail, e.g. by adding “1” to the API:
We see the new request coming through:
And it shows in the failed requests:
Finally, if you have an APIM in front of your API, and you hit the APIM, e.g. through Postman, those requests will also show up in App Insights for the API:
That’s it, we now have App Insights running for this API.