Configure telemetry for environments and extensions

Completed

Before AL events become useful evidence, you need to select who owns the destination and which telemetry the destination receives. This distinction prevents an environment administrator's monitoring needs from becoming confused with an extension publisher's monitoring needs.

Distinguish the two telemetry levels

Environment-level telemetry represents activity for one Business Central environment.

For Business Central online, an administrator configures the environment’s Application Insights connection string in the Business Central admin center or through its API. On-premises deployments use server-instance or tenant configuration.

The destination receives Business Central platform and application telemetry for that environment, subject to the service's telemetry contract and configuration.

Extension-publisher telemetry represents activity generated by one extension. Extension-publisher telemetry includes supported platform signals associated with an extension and custom telemetry emitted by its AL code. The publisher places the applicationInsightsConnectionString property in the extension's app.json. This destination helps a publisher observe the extension across environments where customers install it.

The two levels answer different ownership questions:

Decision Environment-level telemetry Extension-publisher telemetry
Who configures it? A Business Central administrator The extension publisher
Where is it configured? Business Central admin center Extension app.json
What is its primary view? An environment A published extension
Which access is required? Admin center access Source and publish access

One Application Insights resource can receive both during a focused sandbox exercise, but production designs often separate destinations by ownership, access, retention, and cost.

Configure a complete connection string

Use a workspace-based Application Insights resource and copy its complete connection string. The current extension property is applicationInsightsConnectionString. Don't reduce it to legacy instrumentation-key-only guidance. A full connection string contains the routing information that the Application Insights SDK uses, such as an instrumentation key and ingestion endpoint.

The relevant app.json property has this form:

{
  "applicationInsightsConnectionString": "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://westus2-0.in.applicationinsights.azure.com/"
}

The zero instrumentation key makes this example nonworking by design. In an actual project, replace the entire example value with the complete connection string from the supplied resource without adding line breaks. The connection string identifies the telemetry destination and ingestion endpoints. It is not a password or a credential for reading telemetry. Manage production values through your configuration and release process to prevent accidental routing to the wrong resource.

For environment-level telemetry, open the environment in the Business Central admin center and set the Application Insights connection string in its telemetry configuration. Saving this environment setting can trigger an environment restart. Plan the change for a suitable window and confirm that users can reconnect. You need Business Central admin center permission to make this change.

For publisher telemetry, set applicationInsightsConnectionString in app.json to the intended publisher destination. Build the package, then publish and install or upgrade the extension in the sandbox.

Match telemetry scope to the destination

Configuration identifies available destinations. The TelemetryScope argument on Session.LogMessage identifies where a custom event is eligible to go:

  • TelemetryScope::ExtensionPublisher routes the event to the extension-publisher destination configured in app.json.

  • TelemetryScope::All routes the event through all applicable scopes, including the environment-level and extension-publisher destinations when both are configured.

TelemetryScope controls the custom event being logged; it does not change the routing of all platform telemetry. ExtensionPublisher sends only to the configured publisher destination and does not fall back to the environment destination. All sends to both destinations when both are configured, or to whichever applicable destination is configured.

Use ExtensionPublisher when an event serves extension support and product improvement. Use All only when both the environment administrator and extension publisher need the event. A broader scope isn't a substitute for careful data classification.

Telemetry ingestion isn't instantaneous. After you configure a destination and generate activity, allow for ingestion delay before you treat an empty query as a configuration failure. Verify the full connection string, the selected environment, the published app version, and the query time range.

For the current configuration model, see Enable Application Insights telemetry and Application Insights for extensions.