November 6th, 2013

Implementing Deployment Markers in Application Insights

Anisha Pindoria
Senior Program Manager

Application Insights is a set of services that integrates production monitoring data with development tools. In many of the demos you will see us opening the solution and code file directly from the production data. For instance in the screenshot below I can click on those blue dots it will take me directly to the specific changeset used to create that deployment- this is done through deployment markers.

clip_image002

Deployment markers are automatically generated by MSBuild – if you instruct it to do so. There are a couple of ways to give MSBuild parameters but since I wanted everything to continue working from within Visual Studio with F5 I needed to modify the project file. From within Visual Studio you need to right click on the project and choose “unload”

clip_image004

This puts the project into a mode you can edit it. (Seem image below)

clip_image006

At this point you need to insert the parameter GenerateBuildInfoConfigFile = True

See the article:

Diagnose problems in deployment with Visual Studio and Microsoft Monitoring Agent

In my case I also wanted the version and server name information so I actually added this to my project file:

 

 

<PropertyGroup>
    <!– Generate the BuildInfo.config file –>
    <GenerateBuildInfoConfigFile>true</GenerateBuildInfoConfigFile>
    <IncludeServerNameInBuildInfo>true</IncludeServerNameInBuildInfo>
    <VisualStudioVersion>12.0</VisualStudioVersion>
</PropertyGroup>

 

image

Now we should be able to reload the project, check it in, and when we enabled monitoring the deployment markers would be visible….Unfortunately it looks like the current MSBuild implementation is giving the BuildInfo.config file the name APPNAME.BuildInfo.Config and placing it in the BIN directory instead what is needed in the same directory as the Web.config and the file name BuildInfo.config

–but that is easy to fix via another MSBuild directive in the project file:

<Target Name="AfterBuild">

<Copy SourceFiles="C:\web\WebApplication1\WebApplication1\bin\WebApplication1.BuildInfo.CONFIG" DestinationFiles="C:\web\WebApplication1\WebApplication1\BUILDINFO.CONFIG" />

</Target>

 

At this point we are done with the client. At your next deployment, if Application Insights is monitoring that App you will see the deployment marker.

So what do I need to do to get a new Application monitored and an availability test created (assuming the MMA is installed) ?

To see the deployment marker in Application Insights we need to enable monitoring.

Step 1 is add the application to the monitored applications by running Powershell as administrator and running the following command(this is how the BuildConfig file is picked up):

Start-WebApplicationMonitoring "Default Web Site/webapplication1" -Mode Monitor -OutputChannel Cloud -DisplayName webapp1

clip_image008

Step 2 is to create the availability test this is pretty just click on Availability menu – at which point you are prompted for the URL.

clip_image010

At this point you should see availability, performance (both outside in and internal application) AND your deployment markers as seen below

image

image

Category
DevOps

Author

Anisha Pindoria
Senior Program Manager

Anisha is on the Azure DevOps Community team, where she promotes engagement with leading technical community experts and groups to support awareness for Azure DevOps and accelerate the adoption via offline (meetups, conferences and workshops) and online (forums like Stack Overflow, MVP Program, and product group interactions).

0 comments

Discussion are closed.