{"id":56494,"date":"2013-11-06T06:12:00","date_gmt":"2013-11-06T14:12:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/devops\/?p=56494"},"modified":"2019-05-06T06:18:28","modified_gmt":"2019-05-06T14:18:28","slug":"implementing-deployment-markers-in-application-insights","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/implementing-deployment-markers-in-application-insights\/","title":{"rendered":"Implementing Deployment Markers in Application Insights"},"content":{"rendered":"<p>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. <\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/45\/92\/metablogapi\/5826.clip_image002_2D8BA6CC.jpg\"><img decoding=\"async\" title=\"clip_image002\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image002\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/45\/92\/metablogapi\/2705.clip_image002_thumb_461B441C.jpg\" width=\"572\" height=\"324\" \/><\/a><\/p>\n<p>Deployment markers are automatically generated by MSBuild \u2013 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 \u201cunload\u201d <\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/45\/92\/metablogapi\/3487.clip_image004_76451F90.jpg\"><img decoding=\"async\" title=\"clip_image004\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image004\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/45\/92\/metablogapi\/4370.clip_image004_thumb_03AB3297.jpg\" width=\"625\" height=\"325\" \/><\/a><\/p>\n<p>This puts the project into a mode you can edit it. (Seem image below)<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/45\/92\/metablogapi\/2742.clip_image006_2602C810.jpg\"><img decoding=\"async\" title=\"clip_image006\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image006\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/45\/92\/metablogapi\/2843.clip_image006_thumb_057B885E.jpg\" width=\"648\" height=\"366\" \/><\/a><\/p>\n<p>At this point you need to insert the parameter GenerateBuildInfoConfigFile = True<\/p>\n<p>See the article: <\/p>\n<p><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/dn449058.aspx\">Diagnose problems in deployment with Visual Studio and Microsoft Monitoring Agent<\/a><\/p>\n<p>In my case I also wanted the version and server name information so I actually added this to my project file: <\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<blockquote>\n<p><font color=\"#800080\"><strong>&lt;PropertyGroup&gt;          <br \/>&#160;&#160;&#160; &lt;!&#8211; Generate the BuildInfo.config file &#8211;&gt;           <br \/>&#160;&#160;&#160; &lt;GenerateBuildInfoConfigFile&gt;true&lt;\/GenerateBuildInfoConfigFile&gt;           <br \/>&#160;&#160;&#160; &lt;IncludeServerNameInBuildInfo&gt;true&lt;\/IncludeServerNameInBuildInfo&gt;           <br \/>&#160;&#160;&#160; &lt;VisualStudioVersion&gt;12.0&lt;\/VisualStudioVersion&gt;           <br \/>&lt;\/PropertyGroup&gt;<\/strong><\/font><\/p>\n<\/blockquote>\n<p><strong><\/strong><\/p>\n<p>&#160;<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/45\/92\/metablogapi\/6011.image_1F3E82BB.png\"><img decoding=\"async\" title=\"image\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/45\/92\/metablogapi\/4278.image_thumb_087F3B32.png\" width=\"668\" height=\"378\" \/><\/a> <\/p>\n<p>Now we should be able to reload the project, check it in, and when we enabled monitoring the deployment markers would be visible\u2026.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 <b>Web.config<\/b> and the file name <b>BuildInfo.config<\/b><\/p>\n<p>\u2013but that is easy to fix via another MSBuild directive in the project file:<\/p>\n<blockquote>\n<p><font color=\"#800080\"><strong>&lt;Target Name=&quot;AfterBuild&quot;&gt;<\/strong><\/font><\/p>\n<p><font color=\"#800080\"><strong>&lt;Copy SourceFiles=&quot;C:\\web\\WebApplication1\\WebApplication1\\bin\\WebApplication1.BuildInfo.CONFIG&quot; DestinationFiles=&quot;C:\\web\\WebApplication1\\WebApplication1\\BUILDINFO.CONFIG&quot; \/&gt;<\/strong><\/font><\/p>\n<p><font color=\"#800080\"><strong>&lt;\/Target&gt;<\/strong><\/font><\/p>\n<\/blockquote>\n<p>&#160;<\/p>\n<p>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.<\/p>\n<p>So what do I need to do to get a new Application monitored and an availability test created (assuming the MMA is installed) ?<\/p>\n<p>To see the deployment marker in Application Insights we need to enable monitoring.<\/p>\n<p>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): <\/p>\n<p>Start-WebApplicationMonitoring &quot;Default Web Site\/webapplication1&quot; -Mode Monitor -OutputChannel Cloud -DisplayName webapp1<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/45\/92\/metablogapi\/0121.clip_image008_5317B4DE.jpg\"><img decoding=\"async\" title=\"clip_image008\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image008\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/45\/92\/metablogapi\/0636.clip_image008_thumb_4781F79F.jpg\" width=\"750\" height=\"464\" \/><\/a><\/p>\n<p>Step 2 is to create the availability test this is pretty just click on Availability menu \u2013 at which point you are prompted for the URL.<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/45\/92\/metablogapi\/2768.clip_image010_2A0FA693.jpg\"><img decoding=\"async\" title=\"clip_image010\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image010\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/45\/92\/metablogapi\/2100.clip_image010_thumb_30C2B016.jpg\" width=\"751\" height=\"425\" \/><\/a><\/p>\n<p>At this point you should see availability, performance (both outside in and internal application) AND your deployment markers as seen below<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/45\/92\/metablogapi\/3683.image_175AACDC.png\"><img decoding=\"async\" title=\"image\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/45\/92\/metablogapi\/0552.image_thumb_702063A6.png\" width=\"763\" height=\"403\" \/><\/a> <\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/45\/92\/metablogapi\/8507.image_0BC4EF9D.png\"><img decoding=\"async\" title=\"image\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/45\/92\/metablogapi\/6036.image_thumb_40654BD8.png\" width=\"766\" height=\"328\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":241,"featured_media":45953,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-56494","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops"],"acf":[],"blog_post_summary":"<p>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 [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/56494","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/users\/241"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=56494"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/56494\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media\/45953"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media?parent=56494"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=56494"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=56494"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}