Skip to content

Commit d39c74a

Browse files
Merge pull request #228462 from jimmart-dev/jammart-storage-cmk-auto-update-key-impact
storage cmk auto update key no perf impact
2 parents f6ffc6d + 42555f7 commit d39c74a

8 files changed

+74
-31
lines changed

articles/storage/common/customer-managed-keys-configure-existing-account.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ author: tamram
77

88
ms.service: storage
99
ms.topic: how-to
10-
ms.date: 12/13/2022
10+
ms.date: 03/09/2023
1111
ms.author: tamram
1212
ms.reviewer: ozgun
1313
ms.subservice: common
14-
ms.custom: devx-track-azurepowershell, devx-track-azurecli
14+
ms.custom: devx-track-azurepowershell, devx-track-azurecli, engagement-fy23
1515
---
1616

1717
# Configure customer-managed keys in an Azure key vault for an existing storage account
@@ -109,6 +109,8 @@ az role assignment create --assignee-object-id $principalId \
109109

110110
When you configure encryption with customer-managed keys for an existing storage account, you can choose to automatically update the key version used for Azure Storage encryption whenever a new version is available in the associated key vault. Alternately, you can explicitly specify a key version to be used for encryption until the key version is manually updated.
111111

112+
When the key version is changed, whether automatically or manually, the protection of the root encryption key changes, but the data in your Azure Storage account remains encrypted at all times. There is no additional action required on your part to ensure that your data is protected. Rotating the key version doesn't impact performance. There is no downtime associated with rotating the key version.
113+
112114
You can use either a system-assigned or user-assigned managed identity to authorize access to the key vault when you configure customer-managed keys for an existing storage account.
113115

114116
> [!NOTE]
@@ -269,10 +271,18 @@ When you manually update the key version, you'll need to update the storage acco
269271

270272
---
271273

274+
## The impact of changing customer-managed keys
275+
276+
When customer-managed keys are enabled or disabled, or the key or key version is changed, the protection of the root encryption key changes, but the data in your Azure Storage account remains encrypted at all times. There is no additional action required on your part to ensure that your data is protected. Rotating the key version doesn't impact performance. There is no downtime associated with rotating the key version.
277+
272278
[!INCLUDE [storage-customer-managed-keys-change-include](../../../includes/storage-customer-managed-keys-change-include.md)]
273279

280+
If the new key is in a different key vault, you must [grant the managed identity access to the key in the new vault](#choose-a-managed-identity-to-authorize-access-to-the-key-vault). If you choose manual updating of the key version, you will also need to [update the key vault URI](#configure-encryption-for-manual-updating-of-key-versions).
281+
274282
[!INCLUDE [storage-customer-managed-keys-revoke-include](../../../includes/storage-customer-managed-keys-revoke-include.md)]
275283

284+
Disabling the key will cause attempts to access data in the storage account to fail with error code 403 (Forbidden). For a list of storage account operations that will be affected by disabling the key, see [Revoke access to a storage account that uses customer-managed keys](customer-managed-keys-overview.md#revoke-access-to-a-storage-account-that-uses-customer-managed-keys).
285+
276286
[!INCLUDE [storage-customer-managed-keys-disable-include](../../../includes/storage-customer-managed-keys-disable-include.md)]
277287

278288
## Next steps

articles/storage/common/customer-managed-keys-configure-new-account.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ author: tamram
77

88
ms.service: storage
99
ms.topic: how-to
10-
ms.date: 09/29/2022
10+
ms.date: 03/09/2023
1111
ms.author: tamram
1212
ms.reviewer: ozgun
1313
ms.subservice: common
@@ -195,8 +195,12 @@ When you manually update the key version, you'll need to update the storage acco
195195

196196
[!INCLUDE [storage-customer-managed-keys-change-include](../../../includes/storage-customer-managed-keys-change-include.md)]
197197

198+
If the new key is in a different key vault, you must [grant the managed identity access to the key in the new vault](#use-a-user-assigned-managed-identity-to-authorize-access-to-the-key-vault). If you choose manual updating of the key version, you will also need to [update the key vault URI](#configure-encryption-for-manual-updating-of-key-versions).
199+
198200
[!INCLUDE [storage-customer-managed-keys-revoke-include](../../../includes/storage-customer-managed-keys-revoke-include.md)]
199201

202+
Disabling the key will cause attempts to access data in the storage account to fail with error code 403 (Forbidden). For a list of storage account operations that will be affected by disabling the key, see [Revoke access to a storage account that uses customer-managed keys](customer-managed-keys-overview.md#revoke-access-to-a-storage-account-that-uses-customer-managed-keys).
203+
200204
[!INCLUDE [storage-customer-managed-keys-disable-include](../../../includes/storage-customer-managed-keys-disable-include.md)]
201205

202206
## Next steps

articles/storage/common/customer-managed-keys-overview.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services: storage
66
author: tamram
77

88
ms.service: storage
9-
ms.date: 12/13/2022
9+
ms.date: 03/09/2023
1010
ms.topic: conceptual
1111
ms.author: tamram
1212
ms.reviewer: ozgun
@@ -62,7 +62,7 @@ Data in Blob storage and Azure Files is always protected by customer-managed key
6262

6363
## Enable customer-managed keys for a storage account
6464

65-
When you configure a customer-managed key, Azure Storage wraps the root data encryption key for the account with the customer-managed key in the associated key vault or managed HSM. Enabling customer-managed keys doesn't impact performance, and takes effect immediately.
65+
When you configure a customer-managed key, Azure Storage wraps the root data encryption key for the account with the customer-managed key in the associated key vault or managed HSM. Enabling customer-managed keys takes effect immediately and doesn't impact performance.
6666

6767
You can configure customer-managed keys with the key vault and storage account in the same tenant or in different Azure AD tenants. To learn how to configure Azure Storage encryption with customer-managed keys when the key vault and storage account are in the same tenants, see one of the following articles:
6868

@@ -74,7 +74,7 @@ To learn how to configure Azure Storage encryption with customer-managed keys wh
7474
- [Configure cross-tenant customer-managed keys for a new storage account](customer-managed-keys-configure-cross-tenant-new-account.md)
7575
- [Configure cross-tenant customer-managed keys for an existing storage account](customer-managed-keys-configure-cross-tenant-existing-account.md)
7676

77-
When you enable or disable customer-managed keys, or when you modify the key or the key version, the protection of the root encryption key changes, but the data in your Azure Storage account doesn't need to be re-encrypted.
77+
When you enable or disable customer-managed keys, or when you modify the key or the key version, the protection of the root encryption key changes, but the data in your Azure Storage account remains encrypted at all times. There is no additional action required on your part to ensure that your data is protected. Rotating the key version doesn't impact performance. There is no downtime associated with rotating the key version.
7878

7979
You can enable customer-managed keys on both new and existing storage accounts. When you enable customer-managed keys, you must specify a managed identity to be used to authorize access to the key vault that contains the key. The managed identity may be either a user-assigned or system-assigned managed identity:
8080

@@ -106,14 +106,14 @@ When you configure encryption with customer-managed keys, you have two options f
106106

107107
When the key version is explicitly specified, then you must manually update the storage account to use the new key version URI when a new version is created. To learn how to update the storage account to use a new version of the key, see [Configure encryption with customer-managed keys stored in Azure Key Vault](customer-managed-keys-configure-key-vault.md) or [Configure encryption with customer-managed keys stored in Azure Key Vault Managed HSM](customer-managed-keys-configure-key-vault-hsm.md).
108108

109-
When you update the key version, the protection of the root encryption key changes, but the data in your Azure Storage account isn't re-encrypted. There's no further action required from the user.
109+
When you enable or disable customer-managed keys, or when you modify the key or the key version, the protection of the root encryption key changes, but the data in your Azure Storage account remains encrypted at all times. There is no additional action required on your part to ensure that your data is protected. Rotating the key version doesn't impact performance. There is no downtime associated with rotating the key version.
110110

111111
> [!NOTE]
112-
> To rotate a key, create a new version of the key in the key vault or managed HSM, according to your compliance policies. You can rotate your key manually or create a function to rotate it on a schedule.
112+
> To rotate a key, create a new version of the key in the key vault or managed HSM, according to your compliance policies. Azure Storage does not handle key rotation, so you will need to manage rotation of the key in the key vault. You can [rotate your keys manually](customer-managed-keys-configure-existing-account.md#configure-encryption-for-manual-updating-of-key-versions) or [configure them to rotate automatically](customer-managed-keys-configure-existing-account.md#configure-encryption-for-automatic-updating-of-key-versions).
113113
114-
## Revoke access to customer-managed keys
114+
## Revoke access to a storage account that uses customer-managed keys
115115

116-
You can revoke the storage account's access to the customer-managed key at any time. After access to customer-managed keys is revoked, or after the key has been disabled or deleted, clients can't call operations that read from or write to a blob or its metadata. Attempts to call any of the following operations will fail with error code 403 (Forbidden) for all users:
116+
To revoke access to a storage account that uses customer-managed keys, disable the key that is currently being used. To learn how to disable a key in the Azure key vault, see [The impact of changing customer-managed keys](customer-managed-keys-configure-existing-account.md#the-impact-of-changing-customer-managed-keys). After the key has been disabled, clients can't call operations that read from or write to a blob or its metadata. Attempts to call any of the following operations will fail with error code 403 (Forbidden) for all users:
117117

118118
- [List Blobs](/rest/api/storageservices/list-blobs), when called with the `include=metadata` parameter on the request URI
119119
- [Get Blob](/rest/api/storageservices/get-blob)
21 KB
Loading
62.4 KB
Loading

includes/storage-customer-managed-keys-change-include.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ services: storage
55
author: tamram
66
ms.service: storage
77
ms.topic: "include"
8-
ms.date: 08/22/2022
8+
ms.date: 03/09/2023
99
ms.author: tamram
10-
ms.custom: "include file"
10+
ms.custom: "include file", engagement-fy23
1111
---
1212

1313
## Change the key

includes/storage-customer-managed-keys-disable-include.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,28 @@ services: storage
55
author: tamram
66
ms.service: storage
77
ms.topic: "include"
8-
ms.date: 08/22/2022
8+
ms.date: 03/10/2023
99
ms.author: tamram
1010
ms.custom: "include file"
1111
---
1212

13-
## Disable customer-managed keys
13+
## Switch back to Microsoft-managed keys
1414

15-
When you disable customer-managed keys, your storage account is once again encrypted with Microsoft-managed keys.
15+
You can switch from customer-managed keys back to Microsoft-managed keys at any time, using the Azure portal, PowerShell, or the Azure CLI.
1616

1717
# [Azure portal](#tab/azure-portal)
1818

19-
To disable customer-managed keys in the Azure portal, follow these steps:
19+
To switch from customer-managed keys back to Microsoft-managed keys in the Azure portal, follow these steps:
2020

21-
1. Navigate to your storage account and display the **Encryption** settings.
22-
1. Deselect the checkbox next to the **Use your own key** setting.
21+
1. Navigate to your storage account.
22+
1. Under **Security + networking**, select **Encryption**.
23+
1. Change **Encryption type** to **Microsoft-managed keys**.
24+
25+
:::image type="content" source="../articles/storage/common/media/customer-managed-keys-configure-common/portal-enable-microsoft-managed-keys.png" alt-text="Screenshot showing how to switch to Microsoft-managed keys for a storage account.":::
2326

2427
# [PowerShell](#tab/azure-powershell)
2528

26-
To disable customer-managed keys with PowerShell, call [Set-AzStorageAccount](/powershell/module/az.storage/set-azstorageaccount) with the `-StorageEncryption` option, as shown in the following example. Remember to replace the placeholder values in brackets with your own values and to use the variables defined in the previous examples.
29+
To switch from customer-managed keys back to Microsoft-managed keys with PowerShell, call [Set-AzStorageAccount](/powershell/module/az.storage/set-azstorageaccount) with the `-StorageEncryption` option, as shown in the following example. Remember to replace the placeholder values in brackets with your own values and to use the variables defined in the previous examples.
2730

2831
```azurepowershell
2932
Set-AzStorageAccount -ResourceGroupName $storageAccount.ResourceGroupName `
@@ -33,7 +36,7 @@ Set-AzStorageAccount -ResourceGroupName $storageAccount.ResourceGroupName `
3336

3437
# [Azure CLI](#tab/azure-cli)
3538

36-
To disable customer-managed keys with Azure CLI, call [az storage account update](/cli/azure/storage/account#az-storage-account-update) and set the `--encryption-key-source parameter` to `Microsoft.Storage`, as shown in the following example. Remember to replace the placeholder values in brackets with your own values and to use the variables defined in the previous examples.
39+
To switch from customer-managed keys back to Microsoft-managed keys with Azure CLI, call [az storage account update](/cli/azure/storage/account#az-storage-account-update) and set the `--encryption-key-source parameter` to `Microsoft.Storage`, as shown in the following example. Remember to replace the placeholder values in brackets with your own values and to use the variables defined in the previous examples.
3740

3841
```azurecli
3942
az storage account update

includes/storage-customer-managed-keys-revoke-include.md

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,62 @@ services: storage
55
author: tamram
66
ms.service: storage
77
ms.topic: "include"
8-
ms.date: 08/22/2022
8+
ms.date: 03/10/2023
99
ms.author: tamram
1010
ms.custom: "include file"
1111
---
1212

13-
## Revoke customer-managed keys
13+
## Revoke access to a storage account that uses customer-managed keys
1414

15-
Revoking a customer-managed key removes the association between the storage account and the key vault.
15+
To temporarily revoke access to a storage account that is using customer-managed keys, disable the key currently being used in the key vault.
1616

1717
# [Azure portal](#tab/azure-portal)
1818

19-
To revoke customer-managed keys with the Azure portal, disable the key as described in [Disable customer-managed keys](#disable-customer-managed-keys).
19+
To disable a customer-managed key with the Azure portal, follow these steps:
20+
21+
1. Navigate to the key vault that contains the key.
22+
1. Under **Objects**, select **Keys**.
23+
1. Right-click the key and select **Disable**.
24+
25+
:::image type="content" source="../articles/storage/common/media/customer-managed-keys-configure-common/portal-disable-customer-managed-keys.png" alt-text="Screenshot showing how to disable a customer-managed key in the key vault.":::
2026

2127
# [PowerShell](#tab/azure-powershell)
2228

23-
You can revoke customer-managed keys by removing the key vault access policy. To revoke a customer-managed key with PowerShell, call the [Remove-AzKeyVaultAccessPolicy](/powershell/module/az.keyvault/remove-azkeyvaultaccesspolicy) command, as shown in the following example. Remember to replace the placeholder values in brackets with your own values and to use the variables defined in the previous examples.
29+
To revoke a customer-managed key with PowerShell, call the [Update-AzKeyVaultKey](/powershell/module/az.keyvault/update-azkeyvaultkey) command, as shown in the following example. Remember to replace the placeholder values in brackets with your own values to define the variables, or use the variables defined in the previous examples.
2430

2531
```azurepowershell
26-
Remove-AzKeyVaultAccessPolicy -VaultName $keyVault.VaultName `
27-
-ObjectId $storageAccount.Identity.PrincipalId `
32+
$kvName = "<key-vault-name>"
33+
$keyName = "<key-name>"
34+
$enabled = $false
35+
# $false to disable the key / $true to enable it
36+
37+
# Check the current state of the key (before and after enabling/disabling it)
38+
Get-AzKeyVaultKey -Name $keyName -VaultName $kvName
39+
40+
# Disable (or enable) the key
41+
Update-AzKeyVaultKey -VaultName $kvName -Name $keyName -Enable $enabled
2842
```
2943

3044
# [Azure CLI](#tab/azure-cli)
3145

32-
You can revoke customer-managed keys by removing the key vault access policy. To revoke a customer-managed key with Azure CLI, call the [az keyvault delete-policy](/cli/azure/keyvault#az-keyvault-delete-policy) command, as shown in the following example. Remember to replace the placeholder values in brackets with your own values and to use the variables defined in the previous examples.
46+
To revoke a customer-managed key with Azure CLI, call the [az keyvault key set-attributes](/cli/azure/keyvault/key#az-keyvault-key-set-attributes) command, as shown in the following example. Remember to replace the placeholder values in brackets with your own values to define the variables, or use the variables defined in the previous examples.
3347

3448
```azurecli
35-
az keyvault delete-policy \
36-
--name <key-vault> \
37-
--object-id $storage_account_principal
49+
kvName="<key-vault-name>"
50+
keyName="<key-name>"
51+
enabled="false"
52+
# "false" to disable the key / "true" to enable it:
53+
54+
# Check the current state of the key (before and after enabling/disabling it)
55+
az keyvault key show \
56+
--vault-name $kvName \
57+
--name $keyName
58+
59+
# Disable (or enable) the key
60+
az keyvault key set-attributes \
61+
--vault-name $kvName \
62+
--name $keyName \
63+
--enabled $enabled
3864
```
3965

4066
---

0 commit comments

Comments
 (0)