Implementing Transparent Data Encryption (TDE), Backup Encryption, Always Encrypted, Symmetric key and Asymmetric keys all require that a final secret is stored at some point which protects the encryption key(s) used to secure the data. The main difference between a symmetric and asymmetric key is that to perform both the encryption and decryption the same secret is used for a symmetric key, where as an asymmetric key has a secret for each method. This means that in order to share an encryption securely, a asymmetric key is needed so that the ability to use the encryption method can be public, while the decryption is private.
Managing the final secrets used can quickly become an administrative burden and in the past this was only reduced by using expensive hardware or software based extensible key management (EKM) systems. Azure Key Vault allows for a secure cloud based EKM which is easy to setup and greatly streamlines key management.
We'll split the setup into two sections, with the first section being optional if a key vault has already been configured.
Step 1.
Navigate to the Azure portal and create or sign in to your account.
Step 2.
Navigate or search for a new key vault resource.
https://portal.azure.com/#create/Microsoft.KeyVault
Step 3.
Complete key vault creation. Opting for the premium pricing tier allows for hardware backed key storage which can be a requirement for some companies. A hardware based key vault is not vulnerable to software related issues.
The name, subscription and region should be supplied. The key vault name will need to be supplied to anyone wanting to access it.
Step 4.
Create Registered Application in AzureAD tenant
bd34364853ae473d802dc6d25bcab7e9
Step 5.
Add access policy for the key vault
Step 6.
Add key for the registered app.
rPV6zY9l49a2GV/sUITtlrv5uYZDhZuF9hOkIndFTuY=
Step 7.
Add a key to the vault.
The key vault name in the example above is KeyVaultSQL01 with the secret consisting of the Application ID (also known as the Client ID) without hyphens concatenated with the generated AK01 key value.
bd34364853ae473d802dc6d25bcab7e9rPV6zY9l49a2GV/sUITtlrv5uYZDhZuF9hOkIndFTuY=
Once the name and secret have been provided the configuration of SQL Server can begin.
Step 1.
Install the SQL Server Connector for Microsoft Azure Key Vault on all SQL Server database servers. https://www.microsoft.com/en-us/download/details.aspx?id=45344
Note down the installed path as this will be needed later.
This software is supported on Enterprise 64-bit editions and the following SQL Server versions:
Step 2.
Enable the EKM provider.
Step 3.
Register the EKM installed. Alter file install path if needed. This will register a cryptographic provider for SQL Server for the Azure Key Vault Extensible Key Management (EKM) provider.
Step 4.
Create credential using the prerequisite information as shown at the start of this section consisting of the key vault name, Application ID (also known as the Client ID) without hyphens concatenated with the generated key value.
At this stage the credential can be added to your login via the following script.
The preexisting key in the vault can then be registered within SQL Server.
In order for SQL Server to use this key internally a login has to be provided based on this asymmetric key as well as having the required credential. Below is an example of how to configure TDE.
Add TDE to a database using the key.
The management of keys used by SQL Server should now be administered and maintained by Azure Key Vault.
SQL Server connector troubleshooting guide. https://docs.microsoft.com/en-us/sql/relational-databases/security/encryption/sql-server-connector-maintenance-troubleshooting