Adding App Insights to an Azure App Service

Leave a comment

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 see “Your app will be connected to an auto-created Application Insights resource: CarlCRMAPI
Instrumentation key will be added to App Settings. This will overwrite any instrumentation key value in web app configuration files.” Enter a resource name and scroll down before hitting apply:

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.

 

Carl de Souza
Keep learning. Keep building.

Explore AI, agents & Microsoft technology.

I share practical ideas, tutorials, and videos about AI, AI agents, Microsoft technologies, and the Power Platform.

Subscribe on YouTube →
Carl de Souza Enterprise Architect at Microsoft · AI Technology Expert

Leave a Reply

Your email address will not be published. Required fields are marked *