Configure Tenant Service connection strings

Abstract

How to configure the Tenant Service connection strings to all access to the Tenant Service through the Web Item API.

To use the Tenant Service (TS), you must configure a TS connection string. This enables you to read its configuration through the Web Item API. You can configure the connection string in two ways:

  • With Identity Server authorization.

  • With username and password authorization.

When you have configured the connection string using either of those two methods, you must add it to your TS configuration.

To configure a connection string for Identity Server (IS) authorization:

  1. On your IS instance, go to the installation folder, and open the IS config file, for example, \sitecore\Sitecore.Plugin.IdentityServer\Config\identityServer.xml.

  2. Uncomment the <CredentialsClient> node. Inside this node, locate the <ClientSecrets> node. Add a securely generated value that IS can use for TS authentication. For example:

    <CredentialsClient>
         ***
      <ClientSecrets>
         <TenantService>2ffe4e77325d9a7152f7086ea7aa5114</TenantService>
      </ClientSecrets>
    </CredentialsClient>
    
  3. Save the file. Restart the Identity Server to force it to load the updated configuration.

  4. Construct a connection string using the following properties:

    Property

    Description

    name

    Must be sitecore.

    database

    The Sitecore database the connection goes to.

    tenant ID

    The ID for the tenant created in Data Exchange Framework.

    host

    The URL for your Sitecore instance. If you use a scaled Sitecore topology, use the URL for your content management server.

    auth endpoint

    The URL for your Sitecore Identity Server.

    client secret

    The secure value you entered in the identityServer.xml config file.

    client ID

    A unique client ID for the connection.

    For example:

    <add name="sitecore"
    connectionString="database=master;
        tenant id={2A593000-2FDA-1234-1234-092F0CA338BD};
        host=https://my-sitecore-instance;
        timeout=20;
        auth endpoint=https://my-sitecore-identityserver/;
        client secret=2ffe4e77325d9a7152f7086ea7aa5114;
        client id=SitecoreCredentials" />
    
  5. Follow the instructions in Add connection strings to the tenant web service.

To configure a connection string for username and password authorization:

  1. Construct a connection string using the following properties:

    Property

    Description

    name

    Must be sitecore.

    database

    The Sitecore database the connection goes to.

    tenant ID

    The ID for the tenant created in Data Exchange Framework.

    host

    The URL for your Sitecore instance.

    user name

    A user name that has access to Sitecore.

    password

    The password for the user name.

    For example:

    <add name="sitecore"
    connectionString="database=master;
        tenant id={2A593000-2FDA-1234-1234-092F0CA338BD};
        host=https://my-sitecore-instance;
        password=b;
        user name=sitecore\admin;
        timeout=20" />
    
  2. Follow the instructions in Add connection strings to the tenant web service.

To add the necessary connection strings to the tenant web service:

  1. In the TS installation, in the C:\inetpub\wwwroot\<service folder>\App_Config folder, open the ConnectionString.config file.

  2. Locate the connection string named sitecore. If it is not there, add the connection string you constructed. If it is there, replace it with the connection string you constructed.

  3. Save the file.

  4. On the Sitecore servers that connect to the TS, open the server's App_Config\ConnectionStrings.config file.

  5. In the connectionStrings node, add a connection string for the TS. For example:

        <add name="my-tenant" connectionString="https://my-sitecore.service"/>
    

Note

You can test the connection between the Sitecore server and the TS by requesting the http://<tenantservice>/api/tenant URL. The response displays the available TS endpoints.