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.
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”
This puts the project into a mode you can edit it. (Seem image below)
At this point you need to insert the parameter GenerateBuildInfoConfigFile = True
See the article:
In my case I also wanted the version and server name information so I actually added this to my project file:
<!– Generate the BuildInfo.config file –>
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:
<Copy SourceFiles="C:\web\WebApplication1\WebApplication1\bin\WebApplication1.BuildInfo.CONFIG" DestinationFiles="C:\web\WebApplication1\WebApplication1\BUILDINFO.CONFIG" />
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
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.
At this point you should see availability, performance (both outside in and internal application) AND your deployment markers as seen below