Handling telemetry is on of the most important activities that should always be done on a Dynamics 365 Business Central SaaS tenant.
The classical way to inspect the telemetry of a tenant is going to the Admin portal of your tenant, access the Telemetry tab and here inspect the data (by applying filters and so on).
Starting from Dynamics 365 Business Central version 15, you can setup your environment to send telemetry data to Azure Application Insights service. I’ve talked about this service in my Azure Function webcast some weeks ago. Azure Application Insights permits you to monitor your azure resources and detect anomalies. It includes powerful analytics tools to help you diagnose issues and to understand what users actually do with your cloud applications.
This feature is actually in preview. To start sending the telemetry data of your Dynamics 365 Business Central tenant to Azure Application Insights, you need to first create an instance of this service to your Azure subscription. Just go to the Azure Portal and create a new Application Insights instance as in the following picture:
When the Application Insights instance is provisioned, you have an Instrumentational Key (top right corner in the Overview pane). Take note os this key:
To enable your Dynamics 365 Business Central tenant sending telemetry data to Application Insights you need to go to the tenant Admin portal, select your environment, click on the Application Insights key button and then in the opened window click on Enable Application Insights and insert the relative Instrumentation Key:
When you click on Save, the environment is restarted (do that on non working hours) and after that your tenant is ready to send telemetry data to your Azure Application Insights instance.
Actually, Dynamics 365 Business Central sends only telemetry data related to long running SQL queries, alias any SQL query that takes longer than 1000 milliseconds to execute (as I’ve said before, the feature is in preview state). More data will be added in the future.
From the Application Insights Overview dashboard you can start analyzing your telemetry data (graphically or by querying your data):
Here, as an example I’ve clicked on the Server response time section on my dashboard in order to see the details of the queries with a long response time (sent from the telemetry). From this details, you can also select the View in Logs (Analytics) section and then enter into a query editor to analyze your telemetry data more in depth:
This is the real powerful feature of Azure Application Insights: you can use KUSTO query language in order to query all your telemetry data as needed. For example, here I want to analyze all my long running queries logged in the last 3 days:
By selecting a record from the resultset, you can inspect the details of the selected long running query (client type, object that cause the long running query, code executed and so on):
Extremely powerful isn’t it?
Now the common question: Is the Azure Application Insights telemetry integration available only for the SaaS enviroment? No.
You can use Application Insights also for your on-premise installations. For the on-premise world, you can inject the Application Insights Instrumentation Key into your NST instance by using the following Powershell cmdlet:
Set-NAVServerConfiguration -KeyName ApplicationInsightsInstrumentationKey -KeyValue <APPINSIGHTSKEY> -ApplyTo All -ServerInstance <INSTANCENAME>
If you have a multi tenant environment:
Mount-NAVTenant -AadTenantId <AADTENANTID> -DatabaseName <DATABASENAME> -Id <TENANTID> -DisplayName <TENANTNAME> -ApplicationInsightsKey <APPINSIGHTSKEY>
Happy telemetry inspecting