Adding Application Insigts to your Azure Web Application

Having deployed an application to Azure, you would want to track how the application is performing, how are they used and know the appliation issues. Microsoft Azure’s Application Insights allows you to monitor both the health and usage of your web application. So we have usage analysis, monitor availability and performance tracking. This article focus on how to enable your application with Aplication Insights.

There are several ways to integrate Application Insigts to your application. In this article, we will look the in-built way of enabling it from Visual Studio (requires re-publishing your application to Windows Azure for existing applications)

Prerequisites:  
(1) A Windows Azure account
(2) Visual Studio 2013 or 2015
(3) This article also assumes that you have an application that is already deployed or ready to deploy to Windows Azure.

 

Create an Application Insights resource in your Azure account.

Go to Azure portal. Add new resource and select ‘Application Insights’. Choose application type as ASP.NET in the configuration window.

Untitled.png

Untitled0.png

Once created, you can find the ‘Instrumentation Key’ generated for the AI resource. We will discuss about the use of it in a while.

Add Application Insights SDK to your Web Application using Visual Studio

Scenario -1 : If you are creating a new project, the options for integrating the ‘application insights’ are available in the ‘New Project’ dialog as below.

Untitled1.png

Note that, since I have logged in to my Azure account, I am able to select the exising AI resource that I created in the previous step. Nevertheless, you can create a new one for your application if you wish to and it gets created in your Azure Account.

Scenario -2 : If you you have an existing project and you want to enable Application Instigts and deploy to Azure, right click the project and choose ‘Configure Application Insights’ as shown below.

Untitled2

Log in to your Azure account and it provides you same options to choose or create Application Insights resource.

Untitled3

The required resources will be added to your project; let us look into the added resources:

References

Untitled7

web.config

Untitled6Untitled5

 

ApplicationInsights.config

  • This is where we customize the telemetry components such as dependency tracking, performance counters etc. This configuration file gets added and note that your instrumentation key has been automatically pulled from Azure and added to this configuration file.

Untitled8

Publish Your Application to Azure

This is straightforward. Publish your application to Azure and your AI configurations along with your application will be deployed to Azure and ready to collect the instrumentation data.

When it is time to pull some metrics, go to  your Application Insights resource in Azure portal, select the resource and view ‘Performance’

Untitled12.png

Another example below; reviewing the failures.

Capture.PNG

 

Advertisements

2 thoughts on “Adding Application Insigts to your Azure Web Application

  1. Pingback: Adding Custom Application Insights instrumentaiton to Web Pages | MSBLOGS | Biju Paulose

  2. Pingback: ApplicationInsights.config – Tailoring Application Insights Configuration | MSBLOGS | Biju Paulose

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s