Sending Extension Telemetry to Azure Application Insights

APPLIES TO: Business Central 2020 release wave 2 and later

This article describes how to develop an extension to send telemetry data to Azure Application Insights for monitoring and analyzing. Business Central emits telemetry data for several operations that occur when extension code is run. You can configure an extension to send this telemetry data to a specific Application Insights resource on Microsoft Azure. For an overview about the telemetry with Application Insights, see Monitoring and Analyzing Telemetry.

This feature targets publishers of per-tenant extensions to give them insight into issues in their extensions before partners and customers report them.

Get an Application Insights resource in Azure

The first thing to do is to create an Application Insights resource in Azure if you don't have one. For more information, see Create an Application Insights resource.

The Application Insights resource is assigned an instrumentation key, which you can see on the Overview page for the resource in Azure. Copy this key because you'll need it to enable Application Insights in the extension.

Add the Application Insights Key to the extension's app.json

The next step is to add the "applicationInsightsKey"setting the extension's app.json as shown:

"applicationInsightsKey": "<instrumenation key>"

Replace <instrumenation key> with your key.

When done, build the extension package, then publish and install it as usual. When the extension is run from Business Central, Application Insights gathers the telemetry data for viewing and analyzing.

See Also

Getting Started with AL
Publishing and Installing Extensions
JSON Files
Viewing telemetry data in Application Insights
LogMessage Method