Enabling Application Insights for Tenant Telemetry On-Premises

APPLIES TO: Business Central 2019 release wave 2 and later

This article describes how to set up tenants to send telemetry data to Azure Application Insights for on-premises environments.

Get started

  1. Sign in to the Azure portal.

  2. Create an Application Insights resource by following the guidelines at Workspace-based Application Insights resources.

    Important

    If you're running Business Central 2020 release wave 2 (v17) or earlier, don't use an Azure Application Insights resource in Germany regions, like (Europe) Germany West Central or (Europe) Germany North. If you do, traces from Business Central might not be recorded in Application Insights.

  3. Depending on your Business Central version, get the Connection String or Instrumentation Key of the Application Insights resource.

    You can copy this information from the Overview page for resource in the Azure portal.

    • For Business Central 2020 release wave 2 (v17) or earlier, copy the Instrumentation Key.

    • For later versions, copy the Connection String.

      Note

      For these versions, you can use the instrumentation key instead of the connection string. However, for reliability, we recommend that you use the connection string.

Enable on tenants

Once you have the resource and its connection string or instrumentation key, you can enable your tenants to send telemetry to your Application Insights resource.

The way you enable Application Insights depends on whether the Business Central Server instance is configured as a single-tenant or multitenant instance:

  • For a single-tenant server instance, you set the Application Insights Connection String or Application Insights Instrumentation Key setting of the server instance. For more information, see Configuring Business Central Server.

  • For a multitenant server instance, you enable this feature on a per-tenant basis when you mount tenants on the Business Central Server instance.

    The Mount-NAVTenant cmdlet includes the -ApplicationInsightsConnectionString and -ApplicationInsightsKey parameters. For example:

    Mount-NAVTenant -ServerInstance BC180 -Tenant tenant1 -DatabaseName "Demo Database BC (18-0)" -DatabaseServer localhost -DatabaseInstance BCDEMO -ApplicationInsightsConnectionString 'InstrumentationKey=11111111-2222-3333-4444-555555555555;IngestionEndpoint=https://westeurope-1.in.applicationinsights.azure.com/'
    

    or

    Mount-NAVTenant -ServerInstance BC180 -Tenant tenant1 -DatabaseName "Demo Database BC (18-0)" -DatabaseServer localhost -DatabaseInstance BCDEMO -ApplicationInsightsKey 11111111-2222-3333-4444-555555555555
    

Enable in Docker

If you're using the BcContainerHelper module, specify the Application Insights instrumentation key when you create the container. The key is used on the server instance for a single-tenant container. For a multi-tenant container, it's used on the default tenant.

New-BcContainer `
    -accept_eula `
    -updateHosts `
    -artifactUrl (Get-BCArtifactUrl -country us) `
    -applicationInsightsKey "11111111-2222-3333-4444-555555555555" 

You can specify the same or another key when creating more tenants:

New-BcContainerTenant -tenantId "additional" -applicationInsightsKey "11111111-2222-3333-4444-555555555555" 

See Also

Monitoring Long Running SQL Queries
Enable Application Insights for Online
Monitoring and Analyzing With Telemetry