---
title: "Walkthrough: Adding Tenant Service module to Sitecore in Azure Kubernetes Service"
slug: "walkthrough--adding-tenant-service-module-to-sitecore-in-azure-kubernetes-service"
abstract: "Guide to adding the Sitecore Data Exchange Framework Tenant Service module to a container environment using Azure Kubernetes Service."
---
# Walkthrough: Adding Tenant Service module to Sitecore in Azure Kubernetes Service

You can add Data Exchange Framework (DEF) Tenant Service (TS) to a container environement in Azure Kubernetes Service (AKS).

> [!note]
> For AKS deployments, the preferrred URLs for TS connection strings are:
>
> host=http://cm.default.svc.cluster.local;
> auth endpoint=http://id.default.svc.cluster.local/

This walkthrough describes how to:

- Prepare files and folders for deployment.
- Deploy the AKS containers using *kubectl* commands..

<details>
<summary><h2>Prepare files and folders for deployment</h2></summary>

To prepare files and folders in your Kubernetes installation for deployment:

1. Download the Sitecore Experience Platform (SXP) container deployment package from the [Sitecore download page](https://dev.sitecore.net/Downloads/Sitecore_Experience_Platform.aspx). Extract the package and save it, with the folder structure intact, in a temporary folder on your local machine.
2. Download the DEF-TS container deployment package from the [Sitecore download page](https://dev.sitecore.net/Downloads/Data_Exchange_Framework.aspx). Extract it to your local workstation with the folder structure intact.
3. In the DEF-TS container deployment folder, copy the `def-ts\k8s\ltsc2019\overrides\<topology>` folder to the clipboard.
4. In the Sitecore Experience Platform (SXP) container deployment package, navigate to the `K8s\<version>\overrides` folder, and paste in the `def-ts\k8s\ltsc2019\overrides\<topology>` folder (from the clipboard) as `ts-<topology>` (at the same level as the `def topology` folder).
5. In the SXP container deployment package, in the `overrides\ts-<topology>\ingress-nginx` folder, locate the `kustomization.yaml` file. Make sure that parameters in the `bases:` section are overlays with the Sitecore SXP `ingress-nginx` folder for your installation, for example, `../../../xp1/ingress-nginx`.
6. In the SXP container deployment package, in each of the `overrides\ts-<topology>` and `overrides\ts-<topology>\secrets` folders, locate the `kustomization.yaml` file. In each file, make sure that parameters in the `bases` section are overlays with the Sitecore DEF `overrides` folder respectively for your installation, for example, `../xp1`.

    > [!note]
    > Parameters in the `bases:` section contain the placement of the original Sitecore container deployment files or Sitecore DEF deployment files that the `kustomization.yaml` files override.

7. In the `overrides\ts-<topology>\kustomization.yaml` file, in the `images:` section, make sure the `newName` and `newTag` parameters have the appropriate values for the TS images.
8. In the `overrides\ts-<topology>\secrets` folder, open the `tenant-service-sitecore-connection.txt` file and update the connection string details. The file contains an example of how the connection string should look.
9. In the `overrides\ts-<topology>\secrets\tls\global-ts` folder, add the TLS certificates `tsl.crt` and `tls.key` for the `ts.globalhost` host. To add HTTP/TLS certificates for the Tenant Service, see the Installation *Guide for Production Environment with Kubernetes* guide.

</details>

<details>
<summary><h2>Deploy the AKS containers</h2></summary>

Before you deploy the containers to Kubernetes, you must prepare the AKS cluster configuration and deploy the ingress controller. For information on how to do this, see the *Installation Guide for Production Environment for Kubernetes* which is available on the [Sitecore download page](https://dev.sitecore.net/Downloads/Sitecore_Experience_Platform.aspx).

To deploy the container and the necessary Kubernetes components:

1. Open the Windows console, and navigate to the `k8s\<version>` folder.
2. Deploy the secrets. Use this command:

    ```text
    kubectl apply -k ./overrides/ts-<topology>/secrets/
    ```

3. Run the `ingress` folder. Use this command:

    ```text
    kubectl apply -k ./overrides/ts-<topology>/ingress-nginx/
    ```

4. Run the `external` folder. Use this command:

    ```text
    kubectl apply -k ./<topology>/external/
    ```

5. Wait for all containers to have the status *Ok/Running*. You can check the status with this command:

    ```text
    kubectl get pods -o wide
    ```

6. Run the `init` folder. Use this command:

    ```text
    kubectl apply -k ./<topology>/init/
    ```

7. Wait for all containers to have the status *Completed*. You can check the status with this command:

    ```text
    kubectl get pods
    ```

8. To create persistent volumes, run this command:

    ```text
    kubectl apply -f ./<topology>/volumes/azurefile
    ```

9. Run the Sitecore containers with the SFCRM changes. Use this command:

    ```text
    kubectl apply -k ./overrides/ts-<topology>/
    ```

10. Wait for all containers to have the status *Ok/Running*. You can check the status with the `kubectl get pods` command. Obtain the external IP address by using this command:

    ```text
    kubectl get service -l app=nginx-ingress
    ```

11. Update the local host file with the external IP address. For information on how to do this, see the *Installation Guide for Production Environment for Kubernetes*, which is available on the [Sitecore download page](https://dev.sitecore.net/Downloads/Sitecore_Experience_Platform.aspx).
12. To check that the service is running, open a browser, and browse to `https:\\ts.globalhost`.

    > [!note]
    > If you get a Your connection isn't private response, click Advanced, then click Continue to ts.globalhost (unsafe) to continue.

</details>