Skip to content

Commit 6c2204b

Browse files
rwestMSFTmikelawell
andcommitted
Clarified language around EKM and AGs
Co-authored-by: mikelawell <39015075+mikelawell@users.noreply.github.com>
1 parent ef1f0b6 commit 6c2204b

1 file changed

Lines changed: 41 additions & 28 deletions

File tree

docs/relational-databases/security/encryption/setup-steps-for-extensible-key-management-using-the-azure-key-vault.md

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Install and configure the SQL Server Connector for Azure Key Vault.
44
author: Rupp29
55
ms.author: arupp
66
ms.reviewer: vanto, randolphwest
7-
ms.date: 10/05/2022
7+
ms.date: 01/26/2023
88
ms.service: sql
99
ms.subservice: security
1010
ms.topic: conceptual
@@ -22,7 +22,7 @@ helpviewer_keywords:
2222

2323
In this article, you install and configure the [!INCLUDE[ssNoVersion](../../../includes/ssnoversion-md.md)] Connector for Azure Key Vault.
2424

25-
> [!NOTE]
25+
> [!NOTE]
2626
> Extensible Key Management is [not supported](../../../linux/sql-server-linux-editions-and-components-2019.md#Unsupported) for SQL Server on Linux.
2727
2828
## Prerequisites
@@ -351,7 +351,7 @@ Id : https://contosoekmkeyvault.vault.azure.net:443/
351351
Download the SQL Server Connector from the [Microsoft Download Center](https://go.microsoft.com/fwlink/p/?LinkId=521700). The download should be done by the administrator of the [!INCLUDE[ssNoVersion](../../../includes/ssnoversion-md.md)] computer.
352352

353353
> [!NOTE]
354-
>
354+
>
355355
> - SQL Server Connector versions 1.0.0.440 and older have been replaced and are no longer supported in production environments and using the instructions on the [SQL Server Connector Maintenance & Troubleshooting](../../../relational-databases/security/encryption/sql-server-connector-maintenance-troubleshooting.md) page under [Upgrade of SQL Server Connector](sql-server-connector-maintenance-troubleshooting.md#upgrade-of--connector).
356356
> - Starting with version 1.0.3.0, the SQL Server Connector reports relevant error messages to the Windows event logs for troubleshooting.
357357
> - Starting with version 1.0.4.0, there is support for private Azure clouds, including Azure China, Azure Germany, and Azure Government.
@@ -369,13 +369,15 @@ The SQL Server Connector installation also allows you to optionally download sam
369369

370370
To view error code explanations, configuration settings, or maintenance tasks for the SQL Server Connector, see:
371371

372-
- [A. Maintenance Instructions for the SQL Server Connector](../../../relational-databases/security/encryption/sql-server-connector-maintenance-troubleshooting.md#AppendixA)
372+
- [A. Maintenance Instructions for the SQL Server Connector](../../../relational-databases/security/encryption/sql-server-connector-maintenance-troubleshooting.md#AppendixA)
373373
- [C. Error Code Explanations for the SQL Server Connector](../../../relational-databases/security/encryption/sql-server-connector-maintenance-troubleshooting.md#AppendixC)
374374

375375
## Step 4: Configure SQL Server
376376

377377
For a note about the minimum permission levels needed for each action in this section, see [B. Frequently Asked Questions](../../../relational-databases/security/encryption/sql-server-connector-maintenance-troubleshooting.md#AppendixB).
378378

379+
### Configure the `master` database
380+
379381
1. Run **sqlcmd** or open [!INCLUDE [ssmanstudiofull-md](../../../includes/ssmanstudiofull-md.md)].
380382

381383
1. Configure [!INCLUDE[ssNoVersion](../../../includes/ssnoversion-md.md)] to use EKM by running the following [!INCLUDE[tsql](../../../includes/tsql-md.md)] script:
@@ -457,7 +459,7 @@ For a note about the minimum permission levels needed for each action in this se
457459
> [!IMPORTANT]
458460
> Be sure to first complete the Registry prerequisites for this step.
459461

460-
- Replace `EKMSampleASYKey` with the name you'd like the key to have in [!INCLUDE[ssNoVersion](../../../includes/ssnoversion-md.md)].
462+
- Replace `EKMSampleASYKey` with the name you'd like the key to have in [!INCLUDE[ssNoVersion](../../../includes/ssnoversion-md.md)].
461463
- Replace `ContosoRSAKey0` with the name of your key in your Azure key vault.
462464
463465
```sql
@@ -476,8 +478,8 @@ For a note about the minimum permission levels needed for each action in this se
476478
CREATION_DISPOSITION = OPEN_EXISTING;
477479
```
478480
479-
In the preceding example script, `1a4d3b9b393c4678831ccc60def75379` represents the specific version of the key that will be used. If you use this script, it doesn't matter if you update the key with a new version. The key version (for example) `1a4d3b9b393c4678831ccc60def75379` will always be used for database operations.
480-
481+
In the preceding example script, `1a4d3b9b393c4678831ccc60def75379` represents the specific version of the key that will be used. If you use this script, it doesn't matter if you update the key with a new version. The key version (for example) `1a4d3b9b393c4678831ccc60def75379` will always be used for database operations.
482+
481483
For this scenario, you must complete two Registry prerequisites:
482484

483485
1. Create a `SQL Server Cryptographic Provider` registry key on `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft`.
@@ -514,11 +516,13 @@ For a note about the minimum permission levels needed for each action in this se
514516
ADD CREDENTIAL sysadmin_ekm_cred;
515517
```
516518

519+
### Configure the user database to be encrypted
520+
517521
1. Create a test database that will be encrypted with the Azure key vault key.
518522

519523
```sql
520524
--Create a test database that will be encrypted with the Azure key vault key
521-
CREATE DATABASE TestTDE
525+
CREATE DATABASE TestTDE;
522526
```
523527

524528
1. Create a database encryption key by using the `ASYMMETRIC KEY` (`EKMSampleASYKey`).
@@ -543,37 +547,46 @@ For a note about the minimum permission levels needed for each action in this se
543547

544548
```sql
545549
-- CLEAN UP
546-
USE master
547-
ALTER DATABASE [TestTDE] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
548-
DROP DATABASE [TestTDE]
550+
USE master;
551+
GO
552+
ALTER DATABASE [TestTDE] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
553+
DROP DATABASE [TestTDE];
554+
GO
549555
550-
ALTER LOGIN [TDE_Login] DROP CREDENTIAL [sysadmin_ekm_cred]
551-
DROP LOGIN [TDE_Login]
556+
ALTER LOGIN [TDE_Login] DROP CREDENTIAL [sysadmin_ekm_cred];
557+
DROP LOGIN [TDE_Login];
558+
GO
552559
553-
DROP CREDENTIAL [sysadmin_ekm_cred]
560+
DROP CREDENTIAL [sysadmin_ekm_cred];
561+
GO
554562
555-
USE master
556-
DROP ASYMMETRIC KEY [EKMSampleASYKey]
557-
DROP CRYPTOGRAPHIC PROVIDER [AzureKeyVault_EKM]
563+
USE master;
564+
GO
565+
DROP ASYMMETRIC KEY [EKMSampleASYKey];
566+
DROP CRYPTOGRAPHIC PROVIDER [AzureKeyVault_EKM];
567+
GO
558568
```
559569

560-
If the credential has a client secret that is about to expire, a new secret can be assigned to the credential.
570+
For sample scripts, see the blog at [SQL Server Transparent Data Encryption and Extensible Key Management with Azure Key Vault](https://techcommunity.microsoft.com/t5/sql-server/intro-sql-server-transparent-data-encryption-and-extensible-key/ba-p/1427549).
561571

562-
- Update the secret originally created in [Step 1: Set up an Azure AD service principal](#step-1-set-up-an-azure-ad-service-principal).
572+
## Client secrets that are about to expire
563573

564-
Alter the credential using the same identity and new secret using the following code:
574+
If the credential has a client secret that is about to expire, a new secret can be assigned to the credential.
565575

566-
```sql
567-
ALTER CREDENTIAL CREDName
568-
WITH IDENTITY = 'Original Identity',
569-
SECRET = 'New Secret';
570-
```
576+
1. Update the secret originally created in [Step 1: Set up an Azure AD service principal](#step-1-set-up-an-azure-ad-service-principal).
571577

572-
- Restart the SQL Server service.
578+
1. Alter the credential using the same identity and new secret using the following code. Replace `<New Secret>` with your new secret:
573579

574-
- Steps 2 and 3 need to be done on all nodes of an availability group.
580+
```sql
581+
ALTER CREDENTIAL sysadmin_ekm_cred
582+
WITH IDENTITY = 'ContosoEKMKeyVault',
583+
SECRET = '<New Secret>';
584+
```
575585

576-
For sample scripts, see the blog at [SQL Server Transparent Data Encryption and Extensible Key Management with Azure Key Vault](https://techcommunity.microsoft.com/t5/sql-server/intro-sql-server-transparent-data-encryption-and-extensible-key/ba-p/1427549).
586+
1. Restart the SQL Server service.
587+
588+
> [!NOTE]
589+
> If you are using EKM in an availability group (AG), you will need to alter the credential and restart the SQL Server service on all nodes of the AG.
577590

578591
## Next steps
579592

0 commit comments

Comments
 (0)