Sending Extension Telemetry to Azure Application Insights

APPLIES TO: Business Central 2020 release wave 2 and later

This article describes how to set up 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. For an overview about the telemetry with Azure Application Insights, see Monitoring and Analyzing Telemetry.

This feature targets publishers of per-tenant or appsource 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 a connection string, which you can see on the Overview page for the resource in Azure. Copy this connection string because you'll need it to enable Application Insights in the extension.

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

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

"applicationInsightsConnectionString": "<connection string>"

Replace <connection string> with the string that you copied in the Azure Application Insights overview. For more information about the format of the Application Insight connection string, see Connection Strings.

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.

Prior to runtime version 7.2

Up until runtime version 7.2 you cannot use the "applicationInsightsConnectionString" setting. Instead you have to use the "applicationInsightsKey" setting which is added using only the instrumentation key from the Application Insights connection string as shown:

"applicationInsightsKey": "<instrumentation key>"

Where <instrumentation key> is replaced by the key denoted in the connection string as InstrumentationKey=<instrumentation key>;<some other parameters>.

Note

Transition to using connection strings for data ingestion in Application Insights by 31 March 2025. On 31 March 2025, technical support for instrumentation key–based global ingestion in the Application Insights feature of Azure Monitor will end. After that date, your Applications Insights resources will continue to receive data, but Microsoft no longer provide updates or customer support for instrumentation key–based global ingestion.

See Also

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