--- title: "Fortanix DSM with Microsoft SQL Server TDE - Key Rotation" slug: "fortanix-dsm-with-microsoft-sql-server-tde-integration-key-rotation" updated: 2026-09-09T15:32:27Z published: 2026-09-09T15:32:27Z canonical: "support.fortanix.com/fortanix-dsm-with-microsoft-sql-server-tde-integration-key-rotation" --- > ## Documentation Index > Fetch the complete documentation index at: https://support.fortanix.com/llms.txt > Use this file to discover all available pages before exploring further. # Fortanix DSM with Microsoft SQL Server TDE - Key Rotation ## 1.0 Introduction Fortanix recommends updating your **Microsoft Transparent Data Encryption (TDE)** security keys regularly by rotating the available symmetric and asymmetric encryption keys. This article describes the step-by-step procedure for key rotation on a standalone and SQL Always On availability group (AG) setup. Before proceeding with the key rotation steps, ensure the following for the SQL AOG setup only: - The database has been recently backed up. - The primary and secondary replicas are synchronized within the availability group, and failover can occur without any data loss. - If you prefer a particular server for the primary role, then you are switched over to that server. - Take a note of the role (primary or secondary) with which each server node begins. > [!NOTE] > NOTE > > Ensure that you have performed the steps from [*Fortanix DSM with Microsoft SQL Server TDE – Before You Begin*](/v1/docs/fortanix-dsm-with-microsoft-sql-server-tde-integration-before-you-begin)*.* ## 2.0 Rotating keys for TDE To rotate the keys for TDE, you must be logged in as a service account or system administrator (sysadmin) user to rotate the MEK. ### 2.1 Creating Credentials (sysadmin) > [!NOTE] > NOTE > > These credentials may have already been created during the initial setup. > > Either unmap credentials from an existing sysadmin account or map them to the account from which the key rotation will be performed. This section describes the steps to create the credentials to generate the MEK on the Fortanix-Data-Security-Manager (DSM) using the SQL admin. 1. Run the following commands to create a credential in your SQL Server Studio that will be used by the system administrators: ```bash CREATE CREDENTIAL sa_ekm_tde_cred WITH IDENTITY = 'Identity1', SECRET = '' FOR CRYPTOGRAPHIC PROVIDER EKM_Prov ; GO ``` Where, `<DSM_API_KEY>` is the Fortanix DSM API key as copied in [*Fortanix Data Security Manager with Microsoft SQL Server TDE Integration - Before You Begin*](https://support.fortanix.com/docs/data-security-manager-with-microsoft-sql-server-tde-integration-before-you-begin#35-copying-the-api-key). ![Create_Credentials.png](https://cdn.us.document360.io/c3bd85d2-4ad8-4d85-9f60-f1c168a3aad9/Images/Documentation/Screenshot (869).png?sv=2026-02-06&spr=https&st=2026-11-23T19%3A16%3A22Z&se=2026-11-23T20%3A16%3A22Z&sr=b&sp=r&sig=ivVfIXreCwHlx%2FwKPO93%2BnjoJuTLE6VXxxHjhRU%2B1mE%3D) **Figure 1: Create credentials** 2. Add the credential to a highly privileged user, such as your own domain login in the format `[DOMAIN\login]`: ```bash ALTER LOGIN EC2AMAZ-1RDPAEU\Administrator ADD CREDENTIAL "sa_ekm_tde_cred"; GO ``` Run the following commands in case there is no domain, and the machine is part of a workgroup or standalone: ```bash ALTER LOGIN LOCALHOST\Administrator ADD CREDENTIAL "sa_ekm_tde_cred"; GO ``` ![Command_for_No_Domain.png](https://cdn.us.document360.io/c3bd85d2-4ad8-4d85-9f60-f1c168a3aad9/Images/Documentation/12716363160084.png?sv=2026-02-06&spr=https&st=2026-11-23T19%3A16%3A22Z&se=2026-11-23T20%3A16%3A22Z&sr=b&sp=r&sig=asZwWUFudez4Uaci8RXz2xAZlCedtKRjh9owjg%2BQUGc%3D) **Figure 2: Command for no domain** If you are not an administrator and hence unable to alter the login, open the Object Explorer and map the credentials as shown in the following image: ![Map_Credentials.png](https://cdn.us.document360.io/c3bd85d2-4ad8-4d85-9f60-f1c168a3aad9/Images/Documentation/12716335520404.png?sv=2026-02-06&spr=https&st=2026-11-23T19%3A16%3A22Z&se=2026-11-23T20%3A16%3A22Z&sr=b&sp=r&sig=QlT6%2BULQNTIf9l0rwI5g%2B2B2hS4dhXx2FuWEVebeZ%2FU%3D) **Figure 3: Map credentials** ### 2.2 Creating an Asymmetric Key The MSSQL admin has the credentials associated with creating the MEK on the Fortanix DSM. This section describes the steps to rotate the asymmetric key. #### 2.2.1 On Standalone Server/AOG Primary Replica Run the following commands to generate a new asymmetric key using the Fortanix External Key Manager (EKM) Provider: ```bash USE master ; GO CREATE ASYMMETRIC KEY ekm_login_key_v2 FROM PROVIDER EKM_Prov WITH ALGORITHM = RSA_2048, PROVIDER_KEY_NAME = 'SQL_Server_Key_v2' ; GO ``` Where, - `ekm_login_key_v2`: The master key alias on the MSSQL database. - `EKM_Prov`: The Fortanix EKM Provider. - `SQL_Server_Key_v2`: The key created on the Fortanix DSM. ![Rotate_Keys_in_Fortanix_DSM.png](https://cdn.us.document360.io/c3bd85d2-4ad8-4d85-9f60-f1c168a3aad9/Images/Documentation/12716335585556.png?sv=2026-02-06&spr=https&st=2026-11-23T19%3A16%3A22Z&se=2026-11-23T20%3A16%3A22Z&sr=b&sp=r&sig=zV8fkvnOZVkk98PQAjVVTnb2d2%2F9avtTKMouE3W%2FhOs%3D) **Figure 4: Rotate keys in Fortanix DSM** ![Rotate_Keys_in_Databse.png](https://cdn.us.document360.io/c3bd85d2-4ad8-4d85-9f60-f1c168a3aad9/Images/Documentation/12716363343508.png?sv=2026-02-06&spr=https&st=2026-11-23T19%3A16%3A22Z&se=2026-11-23T20%3A16%3A22Z&sr=b&sp=r&sig=xhGYCQBtBP37pSyqreoEw5czVdP61Bi5xMvHzTYMfxQ%3D) **Figure 5: Rotate keys in the database** #### 2.2.2 On AOG Secondary Replica Run the following commands to generate an asymmetric key using the Fortanix External Key Manager (EKM) Provider: ```bash USE master ; CREATE ASYMMETRIC KEY ekm_login_key FROM PROVIDER EKM_Prov WITH PROVIDER_KEY_NAME = 'SQL_Server_Key', CREATION_DISPOSITION = OPEN_EXISTING; GO ``` Where, - `ekm_login_key`: The master key alias on the MSSQL database. - `EKM_Prov`: The Fortanix EKM Provider. - `SQL_Server_Key`: The key created on the Fortanix DSM. ### 2.3 Creating Credentials (DB Engine) Run the following commands to create a credential that will be used by the database engine: ```bash USE master ; GO CREATE CREDENTIAL ekm_tde_cred_v2 WITH IDENTITY = 'Identity_v2', SECRET = '{key}' FOR CRYPTOGRAPHIC PROVIDER EKM_Prov ``` Where, - `ekm_tde_cred_v2`: The name of the credentials. - `EKM_Prov`: The Fortanix EKM Provider. - `SECRET`: The Fortanix DSM API key as copied in [*Fortanix Data Security Manager with Microsoft SQL Server TDE Integration - Before You Begin*](https://support.fortanix.com/docs/data-security-manager-with-microsoft-sql-server-tde-integration-before-you-begin#35-copying-the-api-key). ![CREATE_CREDENTIAL_FOR_DB_ENGINE.png](https://cdn.us.document360.io/c3bd85d2-4ad8-4d85-9f60-f1c168a3aad9/Images/Documentation/12716363181716.png?sv=2026-02-06&spr=https&st=2026-11-23T19%3A16%3A22Z&se=2026-11-23T20%3A16%3A22Z&sr=b&sp=r&sig=idk%2Fpea9ZjmoS4Tv%2BV4CkEepjMKFRFgw8adiDAyK9vM%3D) **Figure 6: Create a credential for the DB engine** ### 2.4 Creating Login (DB Engine) Run the following commands to add a login used by TDE and add the new credential to the login: ```bash CREATE LOGIN EKM_Login_v2 FROM ASYMMETRIC KEY ekm_login_key_v2 ; GO ALTER LOGIN EKM_Login_v2 ADD CREDENTIAL ekm_tde_cred_v2 ; GO ``` Where, - `ekm_login_key_v2`: The master key alias on the MSSQL database. This key is already created in [*Section 2.2: Creating Asymmetric Keys*](/v1/docs/fortanix-dsm-with-microsoft-sql-server-tde-integration-key-rotation#22-creating-an-asymmetric-key). - `EKM_Login_v2`: The login name. - `ekm_tde_cred_v2`: The key created on the Fortanix DSM. This credential is already created in [*Section 2.3: Creating Credentials (DB Engine)*](/v1/docs/fortanix-dsm-with-microsoft-sql-server-tde-integration-key-rotation#23-creating-credentials-db-engine). ![CREATE_LOGIN_FOR_ASYMMETRIC_KEY.png](https://cdn.us.document360.io/c3bd85d2-4ad8-4d85-9f60-f1c168a3aad9/Images/Documentation/12716335493908.png?sv=2026-02-06&spr=https&st=2026-11-23T19%3A16%3A22Z&se=2026-11-23T20%3A16%3A22Z&sr=b&sp=r&sig=ZxDi24iOti%2FDQYn3aPi1%2FU1eia7opmSXlxUB6ekmtF8%3D) **Figure 7: Create login for asymmetric key** ![Map_Credentials2.png](https://cdn.us.document360.io/c3bd85d2-4ad8-4d85-9f60-f1c168a3aad9/Images/Documentation/12716335524500.png?sv=2026-02-06&spr=https&st=2026-11-23T19%3A16%3A22Z&se=2026-11-23T20%3A16%3A22Z&sr=b&sp=r&sig=dk68ZK1CjjC1RTecxHmFiDkbsOAUKF%2BAxIPlkgeCSpU%3D) **Figure 8: Map credential** ### 2.5 Rotating Master Encryption Key (MEK) Run the following commands on the standalone server or primary replica to rotate the MEK for Data Encryption Key (DEK): ```bash USE employee; ALTER DATABASE ENCRYPTION KEY ENCRYPTION BY SERVER ASYMMETRIC KEY ekm_login_key_v2; ``` Where, `employee` is the Database name. ![ENABLE_TDE_KEY_ROTATION.png](https://cdn.us.document360.io/c3bd85d2-4ad8-4d85-9f60-f1c168a3aad9/Images/Documentation/12716335498772.png?sv=2026-02-06&spr=https&st=2026-11-23T19%3A16%3A22Z&se=2026-11-23T20%3A16%3A22Z&sr=b&sp=r&sig=trvvPeTwBxHgimImSnh9gM7BjJwYyWg9V74hP%2BvOrKA%3D) **Figure 9: Enable TDE key rotation** For the old key, the `encryptor_thumbprint` is the Fortanix UUID of the old key. ![Old_key.png](https://cdn.us.document360.io/c3bd85d2-4ad8-4d85-9f60-f1c168a3aad9/Images/Documentation/12716363307668.png?sv=2026-02-06&spr=https&st=2026-11-23T19%3A16%3A22Z&se=2026-11-23T20%3A16%3A22Z&sr=b&sp=r&sig=sp63WpjeZRuHNfLJadoatKPMTDmvAJ9o8%2FeZfoXMtfk%3D) **Figure 10: Old key** After the key rotation, the `encryptor_thumbprint` changes to the new key UUID. ![New_Key.png](https://cdn.us.document360.io/c3bd85d2-4ad8-4d85-9f60-f1c168a3aad9/Images/Documentation/12716363298708.png?sv=2026-02-06&spr=https&st=2026-11-23T19%3A16%3A22Z&se=2026-11-23T20%3A16%3A22Z&sr=b&sp=r&sig=ftkWaU7jqwmEpyrKGAtxk6daoZGuL%2BysOXUmthhUK2c%3D) **Figure 11: New key** > [!NOTE] > NOTE > > This command re-wraps DEK with the rotated master key and will not re-encrypt the data. Run the following command if you want to rotate both DEK and MEK: ```bash USE employee; ALTER DATABASE ENCRYPTION KEY REGENERATE WITH ALGORITHM = AES_256 ENCRYPTION BY SERVER ASYMMETRIC KEY ekm_login_key_v2 ``` This command re-encrypts the whole data. Therefore, it is recommended to plan the downtime before running the command. Fortanix Data Security Manager (DSM) is the world’s first cloud service secured with Intel® SGX. With Fortanix DSM, you can securely generate, store, and use cryptographic keys and certificates, as well as other secrets such as passwords, API keys, tokens, or any blob of data. Your business-critical applications and containers can integrate with Fortanix DSM using legacy cryptographic interfaces (PKCS#11, CNG, and JCE) or using the native Fortanix DSM RESTful interface. ## Related - [Fortanix DSM with Microsoft SQL Server TDE - Introduction](/fortanix-dsm-with-microsoft-sql-server-tde-integration-introduction.md) - [Fortanix DSM with Microsoft SQL Server TDE - Advanced](/fortanix-dsm-with-microsoft-sql-server-tde-integration-advanced.md) - [Fortanix DSM with Microsoft SQL Server TDE - Standalone Server](/fortanix-dsm-with-microsoft-sql-server-tde-integration-standalone-server.md) - [Fortanix DSM with Nutanix](/fortanix-dsm-with-nutanix.md)