Skip to content

Commit 4066f93

Browse files
authored
Merge pull request #26175 from MicrosoftDocs/main
2/24 AM Publish
2 parents 289fa4c + fe6ab41 commit 4066f93

61 files changed

Lines changed: 855 additions & 726 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

azure-sql/database/arm-templates-content-guide.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
title: Azure Resource Manager templates - Azure SQL Database & SQL Managed Instance
2+
title: Azure Resource Manager templates
33
description: Use Azure Resource Manager templates to create and configure Azure SQL Database and Azure SQL Managed Instance.
4-
author: srdan-bozovic-msft
5-
ms.author: srbozovi
4+
author: urosmil
5+
ms.author: urmilano
66
ms.reviewer: wiassaf, mathoma
77
ms.date: 06/30/2021
88
ms.service: sql-db-mi

azure-sql/database/connectivity-settings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Currently, we support TLS 1.0, 1.1, and 1.2. Setting a minimal TLS version ensur
118118
> [!IMPORTANT]
119119
> The default for the minimal TLS version is to allow all versions. After you enforce a version of TLS, it's not possible to revert to the default.
120120
121-
For customers with applications that rely on older versions of TLS, we recommend setting the minimal TLS version according to the requirements of your applications. For customers that rely on applications to connect by using an unencrypted connection, we recommend not setting any minimal TLS version.
121+
For customers with applications that rely on older versions of TLS, we recommend setting the minimal TLS version according to the requirements of your applications. If application requirements are unknown or workloads rely on older drivers that are no longer maintained, we recommend not setting any minimal TLS version.
122122

123123
For more information, see [TLS considerations for SQL Database connectivity](connect-query-content-reference-guide.md#tls-considerations-for-database-connectivity).
124124

azure-sql/database/index.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ landingContent:
150150
- linkListType: reference
151151
links:
152152
- text: Migration guide
153-
url: https://datamigration.microsoft.com/
153+
url: /data-migration/
154154
- text: Transact-SQL (T-SQL)
155155
url: /sql/t-sql/language-reference
156156
- text: Azure CLI
253 KB
Loading
152 KB
Loading

azure-sql/database/transparent-data-encryption-byok-key-rotation.md

Lines changed: 111 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
title: Rotate TDE protector (PowerShell & the Azure CLI)
3-
titleSuffix: Azure SQL Database & Azure Synapse Analytics
4-
description: Learn how to rotate the Transparent data encryption (TDE) protector for a server in Azure used by Azure SQL Database and Azure Synapse Analytics using PowerShell and the Azure CLI.
3+
titleSuffix: Azure SQL Database & Azure SQL Managed Instance & Azure Synapse Analytics
4+
description: Learn how to rotate the Transparent data encryption (TDE) protector for a server in Azure used by Azure SQL Database, Azure SQL Managed Instance, and Azure Synapse Analytics using PowerShell and the Azure CLI.
55
author: GithubMirek
66
ms.author: mireks
77
ms.reviewer: wiassaf, vanto, mathoma
8-
ms.date: 10/26/2022
8+
ms.date: 02/10/2023
99
ms.service: sql-database
1010
ms.subservice: security
1111
ms.topic: how-to
@@ -25,7 +25,7 @@ This article discusses both automated and manual methods to rotate the TDE prote
2525
## Important considerations when rotating the TDE protector
2626

2727
- When the TDE protector is changed/rotated, old backups of the database, including backed-up log files, aren't updated to use the latest TDE protector. To restore a backup encrypted with a TDE protector from Key Vault, make sure that the key material is available to the target server. Therefore, we recommend that you keep all the old versions of the TDE protector in Azure Key Vault (AKV), so database backups can be restored.
28-
- Even when switching from customer managed key (CMK) to service-managed key, keep all previously used keys in AKV. This ensures database backups, including backed-up log files, can be restored with the TDE protectors stored in AKV.
28+
- Even when switching from customer managed key (CMK) to service-managed key, keep all previously used keys in AKV. This ensures database backups, including backed-up log files, can be restored with the TDE protectors stored in AKV.
2929
- Apart from old backups, transaction log files might also require access to the older TDE protector. To determine if there are any remaining logs that still require the older key, after performing key rotation, use the [sys.dm_db_log_info](/sql/relational-databases/system-dynamic-management-views/sys-dm-db-log-info-transact-sql) dynamic management view (DMV). This DMV returns information on the virtual log file (VLF) of the transaction log along with its encryption key thumbprint of the VLF.
3030
- Older keys need to be kept in AKV and available to the server based on the backup retention period configured as back of backup retention policies on the database. This helps ensure any Long Term Retention (LTR) backups on the server can still be restored using the older keys.
3131

@@ -73,7 +73,7 @@ Automatic rotation in a server or managed instance can be used with automatic ke
7373
7474
# [Portal](#tab/azure-portal)
7575

76-
Using the Azure portal:
76+
Using the [Azure portal](https://portal.azure.com):
7777

7878
1. Browse to the **Transparent data encryption** section for an existing server or managed instance.
7979
2. Select the **Customer-managed key** option and select the key vault and key to be used as the TDE protector.
@@ -86,7 +86,7 @@ Using the Azure portal:
8686

8787
For Az PowerShell module installation instructions, see [Install Azure PowerShell](/powershell/azure/install-az-ps). For specific cmdlets, see [AzureRM.Sql](/powershell/module/AzureRM.Sql/).
8888

89-
To enable automatic rotation for the TDE protector using PowerShell, see the following script.
89+
To enable automatic rotation for the TDE protector using PowerShell, see the following script. The `<keyVaultKeyId>` can be [retrieved from Key Vault](/azure/key-vault/keys/quick-create-portal#retrieve-a-key-from-key-vault).
9090

9191
**Azure SQL Database**
9292

@@ -140,6 +140,110 @@ az sql mi tde-key set --server-key-type AzureKeyVault
140140

141141
---
142142

143+
## Automatic key rotation for geo-replication configurations
144+
145+
In an Azure SQL Database geo-replication configuration where the primary server is set to use TDE with CMK, the secondary server also needs to be configured to enable TDE with CMK with the same key used on the primary.
146+
147+
# [Portal](#tab/azure-portal-geo)
148+
149+
Using the [Azure portal](https://portal.azure.com):
150+
151+
1. Browse to the **Transparent data encryption** section for the **primary** server.
152+
2. Select the **Customer-managed key** option and select the key vault and key to be used as the TDE protector.
153+
3. Check the **Auto-rotate key** checkbox.
154+
4. Select **Save**.
155+
156+
:::image type="content" source="media/transparent-data-encryption-byok-key-rotation/auto-rotate-key-primary.png" lightbox="media/transparent-data-encryption-byok-key-rotation/auto-rotate-key.png" alt-text="Screenshot of auto rotate key configuration for transparent data encryption in a geo-replication scenario on the primary server.":::
157+
158+
5. Browse to the **Transparent data encryption** section for the **secondary** server.
159+
6. Select the **Customer-managed key** option and select the key vault and key to be used as the TDE protector. Use the same key as you used for the primary server.
160+
7. Uncheck **Make this key the default TDE protector**.
161+
8. Check the **Auto-rotate key** checkbox.
162+
9. Select **Save**.
163+
164+
:::image type="content" source="media/transparent-data-encryption-byok-key-rotation/auto-rotate-key-secondary.png" lightbox="media/transparent-data-encryption-byok-key-rotation/auto-rotate-key.png" alt-text="Screenshot of auto rotate key configuration for transparent data encryption in a geo-replication scenario on the secondary server.":::
165+
166+
When the key is rotated on the primary server, it's automatically transferred to the secondary server.
167+
168+
# [PowerShell](#tab/azure-powershell-geo)
169+
170+
The `<keyVaultKeyId>` can be [retrieved from Key Vault](/azure/key-vault/keys/quick-create-portal#retrieve-a-key-from-key-vault).
171+
172+
1. Use the [Add-AzSqlServerKeyVaultKey](/powershell/module/az.sql/add-azsqlserverkeyvaultkey) command to add a new key to the **secondary** server.
173+
174+
```powershell
175+
# add the key from Key Vault to the secondary server
176+
Add-AzSqlServerKeyVaultKey -KeyId <keyVaultKeyId> -ServerName <logicalServerName> -ResourceGroup <SQLDatabaseResourceGroupName>
177+
```
178+
179+
1. Add the same key in the first step to the **primary** server.
180+
181+
```powershell
182+
# add the key from Key Vault to the primary server
183+
Add-AzSqlServerKeyVaultKey -KeyId <keyVaultKeyId> -ServerName <logicalServerName> -ResourceGroup <SQLDatabaseResourceGroupName>
184+
```
185+
186+
1. Use [Set-AzSqlInstanceTransparentDataEncryptionProtector](/powershell/module/az.sql/set-azsqlinstancetransparentdataencryptionprotector) to set the key as the primary protector on the primary server with auto key rotation set to `true`.
187+
188+
```powershell
189+
Set-AzSqlServerTransparentDataEncryptionProtector -Type AzureKeyVault -KeyId <keyVaultKeyId> `
190+
-ServerName <logicalServerName> -ResourceGroup <SQLDatabaseResourceGroupName> `
191+
-AutoRotationEnabled $true
192+
```
193+
194+
1. Rotate the key vault key in the Key Vault using the command [Get-AzKeyVaultKey](/powershell/module/az.keyvault/get-azkeyvaultkey) and [Set-AzKeyVaultKeyRotationPolicy](/powershell/module/az.keyvault/set-azkeyvaultkeyrotationpolicy).
195+
196+
```powershell
197+
Get-AzKeyVaultKey -VaultName <keyVaultName> -Name <keyVaultKeyName> | Set-AzKeyVaultKeyRotationPolicy -KeyRotationLifetimeAction @{Action = "Rotate"; TimeBeforeExpiry = "P18M"}
198+
```
199+
200+
1. Check if the SQL Server (both primary and secondary) has the new key or key version:
201+
202+
> [!NOTE]
203+
> Key rotation can take up to an hour to be applied to the server. Wait at least an hour before executing this command.
204+
205+
```powershell
206+
Get-AzSqlServerKeyVaultKey -KeyId <keyVaultKeyId> -ServerName <logicalServerName> -ResourceGroupName <SQLDatabaseResourceGroupName>
207+
```
208+
209+
---
210+
211+
### Using different keys for each server
212+
213+
It's possible to configure the primary and secondary servers with a different key vault key when configuring TDE with CMK in the Azure portal. It's not evident in the Azure portal that the key used to protect the primary server is also the same key that protects the primary database that has been replicated to the secondary server. However, you can use PowerShell, the Azure CLI, or REST APIs to obtain details about keys that are used on the server. This shows that auto rotated keys are transferred from the primary server to the secondary server.
214+
215+
Here's an example of using PowerShell commands to check for keys that are transferred from the primary server to the secondary server after key rotation.
216+
217+
1. Execute the following command on the primary server to display the key details of a server:
218+
219+
```powershell
220+
Get-AzSqlServerKeyVaultKey -ServerName <logicalServerName> -ResourceGroupName <SQLDatabaseResourceGroupName>
221+
```
222+
223+
1. You should see similar results to the following:
224+
225+
```output
226+
ResourceGroupName : <SQLDatabaseResourceGroupName>
227+
ServerName : <logicalServerName>
228+
ServerKeyName : <keyVaultKeyName>
229+
Type : AzureKeyVault
230+
Uri : https://<keyvaultname>.vault.azure.net/keys/<keyName>/<GUID>
231+
Thumbprint : <thumbprint>
232+
CreationDate : 12/13/2022 8:56:32 PM
233+
```
234+
235+
1. Execute the same `Get-AzSqlServerKeyVaultKey` command on the secondary server:
236+
237+
```powershell
238+
Get-AzSqlServerKeyVaultKey -ServerName <logicalServerName> -ResourceGroupName <SQLDatabaseResourceGroupName>
239+
```
240+
241+
1. If the secondary server has a default TDE protector using a different key than the primary server, you should see two (or more) keys. The first key being the default TDE protector, and the second key is the key used in the primary server used to protect the replicated database.
242+
243+
1. When the key is rotated on the primary server, it's automatically transferred to the secondary server. If you were to run the `Get-AzSqlServerKeyVaultKey` again on the primary server, you should see two keys. The first key is the original key, and the second key, which is the current key that was generated as part of the key rotation.
244+
245+
1. Running the `Get-AzSqlServerKeyVaultKey` command on the secondary server should also show the same keys that are present in the primary server. This confirms that the rotated keys on the primary server are automatically transferred to the secondary server, and used to protect the database replica.
246+
143247
## Manual key rotation
144248

145249
Manual key rotation uses the following commands to add a new key, which could be under a new key name or even another key vault. Using this approach supports adding the same key to different key vaults to support high-availability and geo-dr scenarios. Manual key rotation can also be done using the Azure portal.
@@ -317,6 +421,6 @@ The following examples use [az sql mi tde-key set](/cli/azure/sql/mi/tde-key#az-
317421

318422
## Next steps
319423

320-
- In case of a security risk, learn how to remove a potentially compromised TDE protector: [Remove a potentially compromised key](transparent-data-encryption-byok-remove-tde-protector.md).
424+
- If there's a security risk, learn how to remove a potentially compromised TDE protector: [Remove a potentially compromised key](transparent-data-encryption-byok-remove-tde-protector.md).
321425

322426
- Get started with Azure Key Vault integration and Bring Your Own Key support for TDE: [Turn on TDE using your own key from Key Vault using PowerShell](transparent-data-encryption-byok-configure.md).

0 commit comments

Comments
 (0)