Introduction

Transparent Data Encryption is an SQL DB encryption technique. In TDE, primary and secondary data files are encrypted using an encryption key with the help of Database Master Key and TDE Certificate. This is the simplest form of encryption and it has been provided by default in SQL Server 2016.

Always On Availability Group is an HADR (High Availability Disaster Recovery) technique which is introduced in SQL Server 2012. It provides an alternative to Failover Clustering (High Availability) and Mirroring (Disaster Recovery). In simple words, when the database is moved in to the Availability group, two or more physical copies of a database reside on two or more different Servers, which enables us to sync data automatically between the primary and secondary database.

In this article, I will explain the steps involved in implementation of TDE on database that is stored in the Availability Group.

Assumptions

Reader is familiar with the basics of Always On environment and has basic knowledge of different TDE terminologies.

Implementation Steps

Let us assume that the database TestTDEInAO which we are targeting is in Availability Group.

SQL Server
SQL Server

Remove Database from Availability Group

Encrypting Primary copy of the Database

Backup and Restoration on Secondary Node

In this step, we will be backing up Master key, Certificate, and Database along with transactional logs as well and we will be restoring these elements on secondary node/s.

Bring Database in Availability Group

Now, we have encrypted database on primary as well as secondary servers. Now, we will bring these servers back in Availability Group by using TSQL.

Once the database syncing is completed, you will have achieved your goal.!!!!