Sitecore Azure AppInsights CloudRoleName

If you’re planning to use Azure Application Insights for Sitecore, you’ll quickly found that the Application Map report is showing quite an unusual repots.

appinsights-ootb

The mismatched number of instances reported aside, the server name being reported isn’t what I expected.

From inspecting the processor in the initialize pipeline from Sitecore, I can see the following.

This doesn’t quite match what the Microsoft documentation suggested. And I can confirm by going to the logs captured in App Insights that the cloud_RoleName value is not passed at all.

The fix is quite simple, just use the following code to register the right CloudRoleName

Soon after I can see the right role displayed in the App Insights Application Map Dashboard.

appinsights-configured

Now I have better visibility on the application dependencies and which area of my application that can be further optimized for performance.

Note: If you’re using Sitecore Experience Commerce, you’ll need to make some changes with the same approach in order to set the value for CloudRoleName as well.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.