---
title: "Walkthrough: Enabling Application Map for Application Insights for xConnect"
slug: "walkthrough--enabling-application-map-for-application-insights-for-xconnect"
abstract: "Shows how you enable and configure the Application Insights' Application Map feature for Sitecore XP roles and services."
---
# Walkthrough: Enabling Application Map for Application Insights for xConnect

You use the Application Map (part of Azure Application Insights) to get a visual representation of the dependency relationship of components of your application. Each node in the map represents an application component (application node) or its dependency (dependency node). Components are independently deployable parts of a distributed application. The [Microsoft documentation](https://docs.microsoft.com/en-us/azure/azure-monitor/app/app-map?tabs=net) for Azure has more information. This visual representation helps you spot performance bottlenecks or failure hotspots across all components of your distributed application.

The Application Map of the Application Insights service is not enabled by default when you deploy Sitecore XP to the Microsoft Azure App Service.

When you deploy Sitecore to the Microsoft Azure App Service, Sitecore is integrated with the Application Insights service by default. To optimize resource consumption, Sitecore does not collect dependency telemetry events that record information about outgoing HTTP and SQL connections from a Sitecore XP instance by default. The Application Map feature uses these telemetry events to visualize connections between the services and display diagnostic information.

> [!important]
> In Sitecore XP 10.5, do not configure Application Insights by using a standalone instrumentation key setting such as `AppInsightsKey`. Use the full Application Insights connection string with the `AppInsightsConnectionString` setting instead.

This topic shows you how to enable the dependency collector and thereby enable the Application Map.

This walkthrough describes how to:

- Configure the Application Insights connection string
- Enable the dependency collector for Sitecore roles
- Enable the dependency collector for xConnect roles
- Enable the dependency collector for xConnect services
- Specify component role names for xConnect roles

<details>
<summary><h2>Configure the Application Insights connection string</h2></summary>

Before enabling Application Map for xConnect roles and services, configure the Application Insights connection string.

The connection string usually has the following format:

```text
InstrumentationKey={guid};IngestionEndpoint={url};LiveEndpoint={url};ApplicationId={guid}
```

Although the connection string contains an `InstrumentationKey` value, Sitecore XP 10.5 uses the full connection string through the `AppInsightsConnectionString` setting.

In each applicable `AppSettings.config` file, replace the previous standalone instrumentation key setting:

```xml
<add key="AppInsightsKey" value="..." />
```

with the following connection string setting:

```xml
<add key="AppInsightsConnectionString" value="InstrumentationKey={guid};IngestionEndpoint={url};LiveEndpoint={url};ApplicationId={guid}" />
```

Replace the placeholder values with the connection string from your Application Insights resource.

</details>

<details>
<summary><h2>Enable the dependency collector for Sitecore roles</h2></summary>

To enable the collection of dependency telemetry events for Sitecore roles:

- In the `wwwroot` folder, uncomment the following line in the `ApplicationInsights.config` file:

    ```xml
    <!-- <Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector"/> -->
    ```

    After uncommenting, the line should look like this:

    ```xml
    <Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector"/>
    ```

Perform this step on each Sitecore role that you want to track in Application Map.

</details>

<details>
<summary><h2>Enable the dependency collector for xConnect roles</h2></summary>

To enable the collection of dependency telemetry events for xConnect roles:

1. In the `wwwroot` folder, uncomment the following line in the `ApplicationInsights.config` file:

    ```xml
    <!-- <Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector"/> -->
    ```

    After uncommenting, the line should look like this:

    ```xml
    <Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector"/>
    ```

2. In the role's `AppSettings.config` file, replace the previous instrumentation key setting:

    ```xml
    <add key="AppInsightsKey" value="..." />
    ```

    with the connection string setting:

    ```xml
    <add key="AppInsightsConnectionString" value="InstrumentationKey={guid};IngestionEndpoint={url};LiveEndpoint={url};ApplicationId={guid}" />
    ```

3. Keep or update the role name setting as needed:

    ```xml
    <add key="AppInsightsRoleName" value="XConnect Collection" />
    ```

> [!note]
> In Sitecore XP 10.5, you do not need to manually enable or update `sc.AppInsights.Initializer.xml` for this change. The required initializer configuration is included by default.

You have to perform these steps on each xConnect role you want to track.

</details>

<details>
<summary><h2>Enable the dependency collector for xConnect services</h2></summary>

You can enable dependency collection for the supported xConnect services.

The supported services include:

- **XConnect Search Indexer**

    The XConnect Search Indexer web job is hosted in the xConnect Collection Search role:

    ```text
    xp-xc-search/App_Data/jobs/continuous/IndexWorker
    ```

- **Marketing Automation Engine**

    The Marketing Automation Engine web job is hosted in the Marketing Automation Operations role:

    ```text
    xp-ma-ops/App_Data/jobs/continuous/AutomationEngine
    ```

- **Sitecore Cortex Processing Engine**

    The Sitecore Cortex Processing Engine web job is hosted in the Sitecore Cortex Processing role:

    ```text
    xp-cortex-processing/App_Data/jobs/continuous/ProcessingEngine
    ```

To enable the collection of dependency telemetry events for an xConnect service:

1. In the root folder of the web job, uncomment the following line in the `ApplicationInsights.config` file:

    ```xml
    <!-- <Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector"/> -->
    ```

    After uncommenting, the line should look like this:

    ```xml
    <Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector"/>
    ```

    For example, for the XConnect Search Indexer, the file is located at:

    ```text
    App_Data/jobs/continuous/IndexWorker/ApplicationInsights.config
    ```

2. In the web job's `AppSettings.config` file, replace the previous instrumentation key setting:

    ```xml
    <add key="AppInsightsKey" value="..." />
    ```

    with the connection string setting:

    ```xml
    <add key="AppInsightsConnectionString" value="InstrumentationKey={guid};IngestionEndpoint={url};LiveEndpoint={url};ApplicationId={guid}" />
    ```

3. Keep or update the role name setting as needed:

    ```xml
    <add key="AppInsightsRoleName" value="XConnect Search Indexer" />
    ```

> [!note]
> In Sitecore XP 10.5, you do not need to manually enable or update `sc.AppInsights.Initializer.xml` for this change. The required initializer configuration is included by default.

You have to perform these steps on each xConnect service you want to track.

</details>

<details>
<summary><h2>Specify component role names for xConnect roles</h2></summary>

By default, each xConnect role and service are represented as a separate application node with its own role name.

The role name for the application node is specified in the `AppSettings.config` file by using the `AppInsightsRoleName` application setting key. The Application Insights connection string is specified in the same file by using the `AppInsightsConnectionString` application setting key.

Example:

```xml
<?xml version="1.0" encoding="utf-8"?>
<appSettings configBuilders="SitecoreAppSettingsBuilder">
  <add key="configurationDirectorRoot" value="~/App_Data" />
  <add key="configurationEnvironment" value="Production" />
  <add key="AllowInvalidClientCertificates" value="True" />
  <add key="validateCertificateThumbprint" value="CBC23042652046E7C7DEF49AAC292A41D98D048" />
  <add key="AppInsightsConnectionString" value="InstrumentationKey={guid};IngestionEndpoint={url};LiveEndpoint={url};ApplicationId={guid}" />
  <add key="AppInsightsRoleName" value="XConnect Standalone" />
</appSettings>
```

Do not use the previous standalone instrumentation key setting:

```xml
<add key="AppInsightsKey" value="..." />
```

Use the full connection string setting instead:

```xml
<add key="AppInsightsConnectionString" value="InstrumentationKey={guid};IngestionEndpoint={url};LiveEndpoint={url};ApplicationId={guid}" />
```

</details>