Friday, March 20, 2020

Azure Application Insights for Dynamics 365 and Power Platform solution architects and consultants

A best practice which is quite often overlooked is enabling monitoring and logging capabilities in your applications or solutions. You should always monitor your applications/solutions whether they run in the cloud or on premise because you want to know when something fails (before the users start complaining) and also understand how users are working with your solutions.



Both Dynamics 365 and Power Platform have the option to enable integration with Azure Application Insights - but what is Application Insights?

Azure Application Insights  is a feature of Azure Monitor and it is basically an APM (Application Performance Management) tool. Application Insights provides standard integration with a lot of Azure components adding automatic monitoring capabilities but you can also extend it with custom monitoring so if you get an exception in your code that is unhandled Azure Application Insights will pick this up. You can use it for on-premise and cloud applications but the ease with which you can instrument your applications might differ.


You can integrate Application Insights into your model-driven apps (either Dynamics 365 first party apps which you extended or completely custom-model driven apps) by using the Javascript SDK (See Application Insights for web pages for more details). Unfortunately the old documentation on this topic has disappeared - https://azure.microsoft.com/en-us/documentation/articles/app-insights-sample-mscrm/ now does a redirect to the general document. 


Luckily @DanzMaverick wrote an interesting plugin for XrmToolBox which allows you to easily instrument your different model driven forms.  Be sure to update to the latest version though since it contains a number of fixes. If you want to keep up to date with updates on this interesting tool follow https://github.com/Power-Maverick/ApplicationInsightsManager




Using Application Insights Manager plugin you will be able to instrument a number of different model forms using just a number of clicks - behind the scenes it will wire up your forms with the required JavaScript web resources.



A recent update on the Power Platform also allows you to log telemetry for your Canvas Apps using Application Insights.

Dynamics 365 can also leverage Azure components like Azure web apps, web jobs or Azure functions which will also require monitoring and logging capabilities. Depending on the type of component you might get out of the box monitoring or you might need to use code based monitoring - most scenarios are described in the documentation - https://docs.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview

Things I learned when using Azure Application Insights in the last couple of months:

No comments: