﻿#### 

According to the Installation Guide for a Sitecore Production Deployment with Kubernetes, we have to use external services for SQL service, Solr cloud, and Redis cache. While the documentation describes how to initialize data for the SearchStax provider for Solr, it says nothing about how to configure Sitecore to use services such as Azure SQL with Elastic Pool and Azure Redis. This article describes what needs to be done.

#### Azure SQL with Elastic Pool

Once we have Kubernetes Cluster and Azure SQL installed, we need to allow them to communicate with each other. First of all, subnet should be added to **vNet**:

1. Go to the Resource Group where you have AKS installed, find your Virtual network definition and open it:

![](https://www.brimit.com/-/media/images/blog/azure-sql-and-azure-redis-in-aks/image3.png?h=258&amp;w=700&amp;hash=E0623F9AAAF09A2C6FEC816010A88C7B)

2. In the left sidebar find **Subnets**, open it and add a new one:

![](https://www.brimit.com/-/media/images/blog/azure-sql-and-azure-redis-in-aks/image10.png)

**Make sure that Microsoft.Sql is selected in the Services dropdown.**

3. Go to the Resource Group where you have **SQL server** installed, find and open it:

![](https://www.brimit.com/-/media/images/blog/azure-sql-and-azure-redis-in-aks/image2.png?h=252&amp;w=700&amp;hash=E0CA71BF0454AAD0E1095B2981B2A4D0)

4. Copy **Server name, Server admin** and save somewhere. We will need it later.

![](https://www.brimit.com/-/media/images/blog/azure-sql-and-azure-redis-in-aks/image7.png)

5. Find Firewalls and virtual networks In the left side menu

1. Set Yes for Allow Azure services and resources to access this server.
2. Click + Add existing virtual network and select previously created subnet.
3. If you want to access SQL Service from your local machine or network, add a range of IP addresses to allow.

![](https://www.brimit.com/-/media/images/blog/azure-sql-and-azure-redis-in-aks/image8.png?h=414&amp;w=700&amp;hash=F8CDAEC43E38FD47160CD60EB20D398E)

6. Go to the Resource Group where you have **Elastic Pool** installed, find and open it:

![](https://www.brimit.com/-/media/images/blog/azure-sql-and-azure-redis-in-aks/image5.png?h=258&amp;w=700&amp;hash=5A1AB9BCA94ACB91A39A18FF1DAC9FA6)

7. Copy **Elastic Pool Name**:

![](https://www.brimit.com/-/media/images/blog/azure-sql-and-azure-redis-in-aks/image9.png?h=263&amp;w=700&amp;hash=79891A625D4973D64B809C4201455BE3)

8. Now need to update our secrets:

1. Set **SQL Server name** copied earlier to the **sitecore-databaseservername.txt** secret (mssql is a secret default value)
2. Set **Server admin name** copied earlier to the **sitecore-databaseusername.txt** secret. It can be another user but with Admin permissions.
3. Set **Server admin password** to the **sitecore-databasepassword.txt** secret. The password is usually set during the SQL Server set up. You can also reset it in Azure Portal.
4. Set **SQL elastic pool name** copied earlier to the **sitecore-database-elastic-pool-name.txt** secret.

#### Azure Cache for Redis

There is only one connection string (for CM and CD roles) that needs to be updated to allow our Sitecore instance to use Redis Cache hosted in Azure. Once all our connection strings are managed in environment variables defined in k8s yaml files, we can simply change that. Variable that includes a Redis connection string called **Sitecore\_ConnectionStrings\_Redis.Sessions**. The default value looks like below:

![](https://www.brimit.com/-/media/images/blog/azure-sql-and-azure-redis-in-aks/image4.png)

We can update the connection string straight away in a yaml file still keeping that hardcoded, but I would like to suggest you add a new secret file and move the value there.

1. Go to the folder where your secrets are and add a new sitecore-redis-connection-string.txt file.

2. Open secrets customization.yaml file and add the following:

| - name: sitecore-redis<br>
              files:<br>
                - sitecore-redis-connection-string.txt |
| --- |

3. Open **cd.yaml** file and update the **Sitecore\_ConnectionStrings\_Redis.Sessions** environment variable:

| - name: Sitecore\_ConnectionStrings\_Redis.Sessions<br>
              valueFrom:<br>
            <br>    secretKeyRef:<br>
            <br>      name: sitecore-redis<br>
            <br>      key: sitecore-redis-connection-string.txt |
| --- |

4. Do the same for cm.yaml

5. Go to the Resource Group where you have **Azure Cache for Redis** installed, find and open it:

![](https://www.brimit.com/-/media/images/blog/azure-sql-and-azure-redis-in-aks/image6.png)

6. Copy its **Host name:**

**![](https://www.brimit.com/-/media/images/blog/azure-sql-and-azure-redis-in-aks/image1.png)**

6. Now need to update our secret file:

- Set the Host name copied above to the sitecore-redis-connection-string.txt secret.

6. Redeploy your secrets and cm,cd pods.

###### Author

[!\[artsiom-photo\](https://www.brimit.com/-/jssmedia/feature/blogs/authors/artsiom-200.jpg?h=202&amp;iar=0&amp;w=200&amp;hash=41797D2540DF6EB6FDF558360F6F62B8)
Artsem Prashkovich
Sitecore MVP/ Solution Architect](https://www.brimit.com/blog/author?authors=Artsem%20Prashkovich)

#### More on Sitecore

[!\[How Vercel Will Help You Save Effort When Deploying Sophisticated Sitecore Projects\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2024/vercel_cover-image.png)
#Guides#How-toDXPE-commerce
##### How Vercel Will Help You Save Effort When Deploying Sophisticated Sitecore Projects
Optimize and accelerate the development and deployment of complex multisite Sitecore projects.
Alexei Vershalovich on July 17, 2024](https://www.brimit.com/blog/how-vercel-will-help-you-save-effort-when-deploying-sophisticated-sitecore-projects)

[!\[Training Up Tomorrow's Sitecore MVPs: a Mentoring Success Story\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2023/sitecore-mentoring---cover-image.png)
#How-toDXP
##### Training Up Tomorrow's Sitecore MVPs: a Mentoring Success Story
How to participate in the Sitecore Mentor program and help younger colleagues jump-start a career in Sitecore development.
Sergey Baranov on October 2, 2023](https://www.brimit.com/blog/training-up-tomorrows-sitecore-mvps)

[!\[Going Headless. Part 2: When a Headless CMS Is Your Best Bet (if you have Sitecore)\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2022/headless/adobestock_456986731.jpg)
#How-toDXPE-commerce
##### Going Headless. Part 2: When a Headless CMS Is Your Best Bet (if you have Sitecore)
Discover how a headless CMS can benefit organizations that use Sitecore.
Daniil Raschupkin, Palina Trokhautsava on September 15, 2022](https://www.brimit.com/blog/going-headless-part-2-when-a-headless-cms-is-your-best-bet-if-you-have-sitecore)

![](https://bat.bing.net/action/0?ti=187017043&amp;tm=gtm002&amp;Ver=2&amp;mid=788483e4-64d0-4fd6-b893-978f24424ebe&amp;bo=2&amp;gtm_tag_source=1&amp;pi=0&amp;lg=en-US&amp;sw=800&amp;sh=600&amp;sc=24&amp;nwd=1&amp;tl=Configure%20Sitecore%20to%20use%20Azure%20SQL%20and%20Azure%20Redis%20in%20AKS&amp;kw=Sitecore,%20Azure,%20Redis,%20Azure%20SQL,%20Configuration,%20Containers&amp;p=https%3A%2F%2Fwww.brimit.com%2Fblog%2Fconfigure-sitecore-to-use-azure-sql-and-azure-redis-in-aks&amp;r=&amp;lt=332&amp;evt=pageLoad&amp;sv=2&amp;asc=D&amp;cdb=AQAY&amp;rn=523211)