Renaming, aliasing or coalescing applications in Application Insights
Just saw a request on our internal AI alias on how to rename an application that is being monitored in Application Insights.
For those of you that don’t want to read the entire post the directions can be summarized into:
Stop Monitoring the application with the current name, remove the old application THEN create the application by starting monitoring with the new name.
A very common request with Application Insights is to alias an application –typically to differentiate an application from running on one server to that application another on server. For instance in the list of applications below you will see i have an application called “Default Web Site”…I may have several different servers with entirely different types of applications running as the “Default Web Site” -all pushing data into that one application. Unfortunately with the MMA agent defaulting to monitoring all applications and not doing anything to disambiguate the application names this is a pretty common situation.
While you can see the computer information when looking at discreet events this mashup of information can certainly make the performance graphs a mess as you wouldn’t know which computer/app type is generating the data you are seeing (yes the team is looking at this).
I also run into the opposite problem in that i will have applications running on different servers and in different IIS websites but i do want to coalesce the information. An example of this is many company run their review pages on a different web site but still want that data interleaved with the primary website to give a holistic view of the end to end experience.
While this functionality is not available in the Applications view (see above) resolving this is easy…if not intuitive.
Intuitively you would think removing the “Default Web Application” in the view above and hitting the new button to create an application with the correct name would solve this (and it does for applications just monitoring usage or availability data)…but if you try that with an application monitoring performance data like “Default Web Site” application it is magically recreated next time there is traffic on your Default Web Site.
Running the powershell command Get-WebApplcationMonitoringStatus on the client tells the story
In hindsight this does makes sense as you didn’t create most of these applications on the server – you just started monitoring them on the client and THIS created the application.
So this means we need to stop Monitoring the application, remove the old application THEN create the application by starting monitoring with the new name. This is done with the commands:
Stop-WebApplicationMonitoring "Default Web Site"
Start-WebApplicationMonitoring "Default Web Site" -Mode Monitor -OutputChannel Cloud -DisplayName DefaultWebSiteOnChass
At this point I am ready to give the default web site a new name!
Now if i wanted to Coalesce data from two servers into one application instead of using the name “DefaultWebSiteOnChass” i could have used a name of one of the other applications already registered.
In this case I am NOT going to remove the Default Web Site as i do have another server being monitored there.