---
title: "Configure Sitecore for xDB on Azure"
slug: "configure-sitecore-for-xdb-on-azure"
abstract: "Configure an new on-premise Sitecore environment to use with an xDB Cloud deployment."
---
# Configure Sitecore for xDB on Azure

You can configure an on-premise Sitecore 9.1 environment (or later), for use with a self-managed Experience Database (xDB) Azure deployment; that is, an Azure-based, self-supported xDB server. According to the Sitecore xDB topology, you can deploy the following roles to the Cloud:

- Processing
- Reporting
- XConnect Collection
- XConnect Collection Search
- XConnect Reference Data
- Marketing Automation Operations
- Marketing Automation Reporting
- Sitecore Cortex Processing
- Sitecore Cortex Reporting

You can use xDB in combination with on-premise Sitecore Content Management (CM) and Content Delivery (CD) roles to provide the Experience Database features in the Cloud. Refer to the [Sitecore Experience Platform installation guide](https://dev.sitecore.net/Downloads/Sitecore_Experience_Platform/92/Sitecore_Experience_Platform_92_Initial_Release.aspx) and the [Sitecore Azure deployment guide](https://doc.sitecore.com/xp/en/developers/92/sitecore-experience-manager/walkthrough--deploying-a-new-sitecore-environment-to-the-microsoft-azure-app-service.html "Walkthrough: Deploying a new Sitecore environment to the Microsoft Azure App service") for the correct connection strings between environments, and to prepare the correct client certificate configuration.

<details>
<summary><h2>Prepare to configure Sitecore for xDB on Azure</h2></summary>

Before you configure Sitecore for xDB Cloud, you must:

- Create and install a Client Authentication Certificate by following the steps in the [Sitecore Experience Platform installation guide](https://dev.sitecore.net/Downloads/Sitecore_Experience_Platform/92/Sitecore_Experience_Platform_92_Initial_Release.aspx#), **Production Environment Setup**, *Setting up Client Certificates*, (SIF does this automatically).
- Select a topology that suits you best, choose either the [xDB Single or xDB scaled topology for Azure](https://doc.sitecore.com/xp/en/developers/92/sitecore-experience-manager/sitecore-configurations-and-topology-for-azure.html "Sitecore configurations and topology for Azure"), and [create a new instance](https://doc.sitecore.com/xp/en/developers/92/sitecore-experience-manager/walkthrough--deploying-a-new-sitecore-environment-to-the-microsoft-azure-app-service.html "Walkthrough: Deploying a new Sitecore environment to the Microsoft Azure App service").
- Install the full XP, then to remove all other roles, follow the instructions in [Clean up roles](https://doc.sitecore.com/xp/en/developers/92/sitecore-experience-manager/configure-sitecore-for-xdb-on-azure.html#UUID-2d5df926-981c-3b73-dbb4-bb22cae9c7d6_section-5cc0686a57c26-idm45510781670000 "Clean up roles").
- Provide access for Azure SQL from your on-premise environment by [configuring firewall rules](https://docs.microsoft.com/en-us/azure/sql-database/sql-database-control-access#firewall-and-firewall-rules).

To ensure your Sitecore instance(s) have access to the Client Authentication Certificate:

1. On the Control panel, in **Administrative tools**, **Certificate Manager**, open the certificate.
2. Right-click the certificate file, then go to: **All Tasks**, **Manage private keys**, and click **Add**.
3. In the pop-up dialog, go to the **From this location** field, and select your local computer.
4. Enter the type object names in the following format:
    - If you are running Sitecore as an App Pool: `IIS AppPool\<Instance name>`.
    - If you are running Sitecore as a Network Service: provide read access to `Network Service`.
5. On the **Security** tab, select your group or user name, then select the **Allow** check box for read-access.

> [!note]
> If you have connection issues with xDB, check that the certificate location is set to `LocalMachine`, and that the private keys of the certificate were generated for your App Pools.
>
> Message: The certificate was not found.
> Store: My, Location: CurrentUser, FindType: FindByThumbprint, FindValue:
> CBC23042652046E7C7DEF49AAC2923A41D98D048, InvalidAllowed: True.
>
> Source: Sitecore.Xdb.Common.Web

</details>

<details>
<summary><h2>Configure on-premise Sitecore roles</h2></summary>

To configure the on-premise Sitecore roles, you must set up connection strings and patch configuration files.

> [!note]
> Do not make changes directly to the configuration files, instead use a patch file to customize the Sitecore configuration. You must create a [patch file](https://doc.sitecore.com/xp/en/developers/92/platform-administration-and-architecture/use-a-patch-file-to-customize-the-sitecore-configuration.html) that can perform the required changes during run time.

### The XM Content Management role

1. Refer to the following example to append xDB connections to the `ConnectionStrings.config` file.

    > [!note]
    > When you installed the CM role using the XP Scaled packages, the xDB connection strings were included and are therefore already present. This means you must only ensure that the values are correct.

    ```xml
    <add name="xconnect.collection" connectionString="https://XConnectCollectionURL"/>
    <add name="xconnect.collection.certificate" connectionString="StoreName=My;StoreLocation=LocalMachine;FindType=FindByThumbprint; FindValue=CertificateThumbprint" />
    <add name="xdb.referencedata" connectionString="<XdbRefDataDBConnectionString>"/>
    <add name="xdb.referencedata.client" connectionString="https://XConnectRefDataUrl" />
    <add name="xdb.referencedata.client.certificate" connectionString="StoreName=My;StoreLocation=LocalMachine;FindType=FindByThumbprint; FindValue= CertificateThumbprint" />
    <add name="reporting.apikey" connectionString="XdbReportingAPIKey" />
    <add name="reporting" connectionString="<XdbReportingDBConnectionString>" />
    <add name="xdb.marketingautomation.reporting.client" connectionString="https://XConnectAutomationReporting"/>
    <add name="xdb.marketingautomation.reporting.client.certificate" connectionString="StoreName=My;StoreLocation=LocalMachine;FindType=FindByThumbprint; FindValue= CertificateThumbprint" />
    <add name="xdb.marketingautomation.operations.client" connectionString="https://XConnectAutomationOperations" />
    <add name="xdb.marketingautomation.operations.client.certificate" connectionString="StoreName=My;StoreLocation=LocalMachine;FindType=FindByThumbprint; FindValue=CertificateThumbprint " />
    <add name="sitecore.reporting.client" connectionString="https://CortexReporting"/>
    <add name="sitecore.reporting.client.certificate" connectionString="StoreName=My;StoreLocation=LocalMachine;FindType=FindByThumbprint; FindValue= CertificateThumbprint" />
    ```

2. To set up a connection to the *Processing* and *Reporting* servers, open the` \App_Config\Sitecore\Marketing.xDB\Sitecore.Xdb.Remote.Client.config` file, and set the `serviceUrl` parameter for the **Reporting** and **Processing** nodes to point to the URLs of the *Reporting* and *Processing* services that are deployed as a part of xDB respectively.

> [!note]
> The Reporting API Key uses a unique value, such as a GUID, for authentication when communicating from the CM role to the Reporting Web App. This is called a [Certificate Thumbprint value](https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-retrieve-the-thumbprint-of-a-certificate). You must use the same value for xDB deployment and the CM connection string.

### The XM Content Delivery role

Append the xDB connections to the `ConnectionStrings.config` file.

> [!note]
> When you installed the CD role using the XP Scaled packages, the xDB connection strings were included and are therefore already present. This means you must only ensure that the values are correct.

```xml
<add name="xconnect.collection" connectionString="https://XConnectCollection" />
<add name="xconnect.collection.certificate" connectionString="StoreName=My;StoreLocation=LocalMachine;FindType=FindByThumbprint; FindValue=CertificateThumbprint" />
<add name="xdb.referencedata.client" connectionString="https://XConnectRefDataUrl" />
<add name="xdb.referencedata.client.certificate" connectionString="StoreName=My;StoreLocation=LocalMachine;FindType=FindByThumbprint; FindValue= CertificateThumbprint" />
<add name="xdb.marketingautomation.reporting.client" connectionString="https://XConnectAutomationReporting"/>
<add name="xdb.marketingautomation.reporting.client.certificate" connectionString="StoreName=My;StoreLocation=LocalMachine;FindType=FindByThumbprint; FindValue= CertificateThumbprint" />
<add name="xdb.marketingautomation.operations.client" connectionString="https://XConnectAutomationOperations" />
<add name="xdb.marketingautomation.operations.client.certificate" connectionString="StoreName=My;StoreLocation=LocalMachine;FindType=FindByThumbprint; FindValue=CertificateThumbprint " />

```

</details>

<details>
<summary><h2>Clean up roles</h2></summary>

To clean up roles that are not CD, CM, or Identity Server,

1. Stop and remove the following IIS websites:
    - collection
    - ma
    - mareporting
    - prc
    - processingEngine
    - refdata
    - rep
    - reporting
    - search
2. Remove the following SQL databases:
    - MarketingAutomation
    - Processing.Pools
    - Processing.Tasks
    - ProcessingEngineStorage
    - ProcessingEngineTasks
    - ReferenceData
    - Reporting
    - Xdb.Collection.Shard0
    - Xdb.Collection.Shard1
    - Xdb.Collection.ShardMapManager
3. Configure the Core, Master, and Security databases:
    - xDB on Azure deploys the Core and Master databases in Azure SQL for the Processing and Reporting roles. An on-premise installation also deploys the Core and Master databases for content management and content delivery.
    - Decide where you will store the Core and Master databases, edit the connection strings of the CM/CD or Reporting/Processing servers, and remove any duplicated databases.
    - Depending on where you host your Core database, edit the security connection string for the appropriate server: Identity, CM, or CD.

</details>

<details>
<summary><h2>Align your search providers</h2></summary>

xDB Cloud uses Azure Cognitive Search as the default Search provider, and Solr as the default for an on-premise setup. There are two ways to align this setup:

- [Switch the on-premise solution to Azure Cognitive Search](https://doc.sitecore.com/xp/en/developers/92/platform-administration-and-architecture/walkthrough--configure-azure-cognitive-search.html).
- [Switch the xDB Cloud solution to Solr](https://doc.sitecore.com/xp/en/developers/92/platform-administration-and-architecture/configure-a-search-and-indexing-provider.html).

In both scenarios, you must configure one Search provider instance for both environments and rebuild the Search indexes after switching.

</details>