You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/storage/common/customer-managed-keys-configure-key-vault.md
+73-9Lines changed: 73 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ author: tamram
7
7
8
8
ms.service: storage
9
9
ms.topic: how-to
10
-
ms.date: 02/16/2021
10
+
ms.date: 01/13/2022
11
11
ms.author: tamram
12
12
ms.reviewer: ozgun
13
13
ms.subservice: common
@@ -123,7 +123,7 @@ az keyvault set-policy \
123
123
124
124
## Add a key
125
125
126
-
Next, add a key in the key vault.
126
+
Next, add a key to the key vault.
127
127
128
128
Azure Storage encryption supports RSA and RSA-HSM keys of sizes 2048, 3072 and 4096. For more information about keys, see [About keys](../../key-vault/keys/about-keys.md).
129
129
@@ -166,7 +166,7 @@ When you configure encryption with customer-managed keys, you can choose to auto
166
166
167
167
Azure Storage can automatically update the customer-managed key that is used for encryption to use the latest key version. When the customer-managed key is rotated in Azure Key Vault, Azure Storage will automatically begin using the latest version of the key for encryption.
168
168
169
-
# [Azure portal](#tab/portal)
169
+
###[Azure portal](#tab/portal)
170
170
171
171
To configure customer-managed keys with automatic updating of the key version in the Azure portal, follow these steps:
172
172
@@ -178,24 +178,58 @@ To configure customer-managed keys with automatic updating of the key version in
178
178
1. Select the **Customer Managed Keys** option.
179
179
1. Choose the **Select from Key Vault** option.
180
180
1. Select **Select a key vault and key**.
181
-
1. Select the key vault containing the key you want to use.
182
-
1. Select the key from the key vault.
181
+
1. Select the key vault containing the key you want to use. You can also create a new key vault.
182
+
1. Select the key from the key vault. You can also create a new key.
183
183
184
184

185
185
186
+
1. Select the type of identity to use to authenticate access to the key vault. The options include **System-assigned** (the default) or **User-assigned**. To learn more about each type of managed identity, see [Managed identity types](../../active-directory/managed-identities-azure-resources/overview.md#managed-identity-types).
187
+
188
+
1. If you select **System-assigned**, the system-assigned managed identity for the storage account is created under the covers, if it does not already exist.
189
+
1. If you select **User-assigned**, then you must select an existing user-assigned identity that has permissions to access the key vault. To learn how to create a user-assigned identity, see [Manage user-assigned managed identities](../../active-directory/managed-identities-azure-resources/how-manage-user-assigned-managed-identities.md).
190
+
191
+
:::image type="content" source="media/customer-managed-keys-configure-key-vault/select-user-assigned-managed-identity-portal.png" alt-text="Screenshot showing how to select a user-assigned managed identity for key vault authentication":::
192
+
186
193
1. Save your changes.
187
194
188
195
After you've specified the key, the Azure portal indicates that automatic updating of the key version is enabled and displays the key version currently in use for encryption.
189
196
190
197
:::image type="content" source="media/customer-managed-keys-configure-key-vault/portal-auto-rotation-enabled.png" alt-text="Screenshot showing automatic updating of the key version enabled":::
191
198
192
-
# [PowerShell](#tab/powershell)
199
+
###[PowerShell](#tab/powershell)
193
200
194
201
To configure customer-managed keys with automatic updating of the key version with PowerShell, install the [Az.Storage](https://www.powershellgallery.com/packages/Az.Storage) module, version 2.0.0 or later.
195
202
196
-
To automatically update the key version for a customer-managed key, omit the key version when you configure encryption with customer-managed keys for the storage account. Call [Set-AzStorageAccount](/powershell/module/az.storage/set-azstorageaccount) to update the storage account's encryption settings, as shown in the following example, and include the **-KeyvaultEncryption** option to enable customer-managed keys for the storage account.
203
+
You can use either a system-assigned managed identity or a user-assigned managed identity to authenticate access to the key vault. To learn more about each type of managed identity, see [Managed identity types](../../active-directory/managed-identities-azure-resources/overview.md#managed-identity-types).
197
204
198
-
Remember to replace the placeholder values in brackets with your own values and to use the variables defined in the previous examples.
205
+
To authenticate access to the key vault with a system-assigned managed identity, assign the system-assigned managed identity to the storage account by calling [Set-AzStorageAccount](/powershell/module/az.storage/set-azstorageaccount):
To authenticate access to the key vault with a user-assigned managed identity, first find the object ID of the user-assigned managed identity. To run this example, you'll need the resource ID of the user-assigned managed identity.
Next, to set the access policy for the key vault, call [Set-AzKeyVaultAccessPolicy](/powershell/module/az.keyvault/set-azkeyvaultaccesspolicy), providing the identifier for the system-assigned managed identity. For more information about assigning the key vault access policy, see [Assign a Key Vault access policy using Azure PowerShell](../../key-vault/general/assign-access-policy-powershell.md)).
222
+
223
+
```powershell
224
+
Set-AzKeyVaultAccessPolicy `
225
+
-VaultName $keyVault.VaultName `
226
+
-ObjectId $objectId `
227
+
-PermissionsToKeys wrapkey,unwrapkey,get
228
+
```
229
+
230
+
For more information, see [Assign a Key Vault access policy using Azure PowerShell](../../key-vault/general/assign-access-policy-powershell.md)).
231
+
232
+
Finally, configure the customer-managed key. To automatically update the key version for the customer-managed key, omit the key version when you configure encryption with customer-managed keys for the storage account. Call [Set-AzStorageAccount](/powershell/module/az.storage/set-azstorageaccount) to update the storage account's encryption settings, as shown in the following example, and include the **-KeyvaultEncryption** option to enable customer-managed keys for the storage account.
To configure customer-managed keys with automatic updating of the key version with Azure CLI, install [Azure CLI version 2.4.0](/cli/azure/release-notes-azure-cli#april-21-2020) or later. For more information, see [Install the Azure CLI](/cli/azure/install-azure-cli).
211
245
212
-
To automatically update the key version for a customer-managed key, omit the key version when you configure encryption with customer-managed keys for the storage account. Call [az storage account update](/cli/azure/storage/account#az_storage_account_update) to update the storage account's encryption settings, as shown in the following example. Include the `--encryption-key-source` parameter and set it to `Microsoft.Keyvault` to enable customer-managed keys for the account.
246
+
You can use either a system-assigned managed identity or a user-assigned managed identity to authenticate access to the key vault. To learn more about each type of managed identity, see [Managed identity types](../../active-directory/managed-identities-azure-resources/overview.md#managed-identity-types).
247
+
248
+
To authenticate access to the key vault with a system-assigned managed identity, assign the system-assigned managed identity to the storage account by calling [az storage account update](/cli/azure/storage/account#az_storage_account_update):
249
+
250
+
```azurecli-interactive
251
+
az storage account update \
252
+
--name <storage-account> \
253
+
--resource-group <resource_group> \
254
+
--assign-identity
255
+
```
256
+
257
+
To authenticate access to the key vault with a user-assigned managed identity, first find the object ID of the user-assigned managed identity.
258
+
259
+
```azurecli-interactive
260
+
az identity show \
261
+
--name <name-of-user-assigned-managed-identity> \
262
+
--resource-group <resource-group>
263
+
```
264
+
265
+
Next, to set the access policy for the key vault, call [az keyvault set-policy](/cli/azure/keyvault#az_keyvault_set_policy) and provide the object ID of the managed identity:
266
+
267
+
```azurecli-interactive
268
+
az keyvault set-policy \
269
+
--name <key-vault> \
270
+
--resource-group <resource_group>
271
+
--object-id <object-id> \
272
+
--key-permissions get unwrapKey wrapKey
273
+
```
274
+
275
+
Finally, configure the customer-managed key. To automatically update the key version for a customer-managed key, omit the key version when you configure encryption with customer-managed keys for the storage account. Call [az storage account update](/cli/azure/storage/account#az_storage_account_update) to update the storage account's encryption settings, as shown in the following example. Include the `--encryption-key-source` parameter and set it to `Microsoft.Keyvault` to enable customer-managed keys for the account.
213
276
214
277
Remember to replace the placeholder values in brackets with your own values.
215
278
@@ -248,6 +311,7 @@ To configure customer-managed keys with manual updating of the key version in th
248
311

249
312
250
313
1. Specify the subscription that contains the key vault.
314
+
1. Specify either a system-assigned or user-assigned managed identity.
Copy file name to clipboardExpand all lines: articles/storage/common/customer-managed-keys-overview.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ services: storage
6
6
author: tamram
7
7
8
8
ms.service: storage
9
-
ms.date: 06/01/2021
9
+
ms.date: 01/13/2022
10
10
ms.topic: conceptual
11
11
ms.author: tamram
12
12
ms.reviewer: ozgun
@@ -29,17 +29,17 @@ You can either create your own keys and store them in the key vault or managed H
29
29
30
30
## About customer-managed keys
31
31
32
-
The following diagram shows how Azure Storage uses Azure Active Directory and a key vault or managed HSM to make requests using the customer-managed key:
32
+
The following diagram shows how Azure Storage uses Azure AD and a key vault or managed HSM to make requests using the customer-managed key:
33
33
34
-

34
+
:::image type="content" source="media/customer-managed-keys-overview/encryption-customer-managed-keys-diagram.png" alt-text="Diagram showing how customer-managed keys work in Azure Storage":::
35
35
36
36
The following list explains the numbered steps in the diagram:
37
37
38
-
1. An Azure Key Vault admin grants permissions to encryption keys to the managed identity that's associated with the storage account.
39
-
2. An Azure Storage admin configures encryption with a customer-managed key for the storage account.
40
-
3. Azure Storage uses the managed identity that's associated with the storage account to authenticate access to Azure Key Vault via Azure Active Directory.
41
-
4. Azure Storage wraps the account encryption key with the customer-managed key in Azure Key Vault.
42
-
5. For read/write operations, Azure Storage sends requests to Azure Key Vault to unwrap the account encryption key to perform encryption and decryption operations.
38
+
1. An Azure Key Vault admin grants permissions to encryption keys to either a user-assigned managed identity, or to the system-assigned managed identity that's associated with the storage account.
39
+
1. An Azure Storage admin configures encryption with a customer-managed key for the storage account.
40
+
1. Azure Storage uses the managed identity to which the Azure Key Vault admin granted permissions in step 1 to authenticate access to Azure Key Vault via Azure AD.
41
+
1. Azure Storage wraps the account encryption key with the customer-managed key in Azure Key Vault.
42
+
1. For read/write operations, Azure Storage sends requests to Azure Key Vault to unwrap the account encryption key to perform encryption and decryption operations.
43
43
44
44
The managed identity that's associated with the storage account must have these permissions at a minimum to access a customer-managed key in Azure Key Vault:
45
45
@@ -65,14 +65,14 @@ When you configure a customer-managed key, Azure Storage wraps the root data enc
65
65
66
66
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 does not need to be re-encrypted.
67
67
68
-
Customer-managed keys can enabled only on existing storage accounts. The key vault or managed HSM must be configured to grant permissions to the managed identity that is associated with the storage account. The managed identity is available only after the storage account is created.
68
+
You can enable customer-managed keys on existing storage accounts or on new accounts when you create them. When you enable customer-managed keys while creating an account, only user-assigned managed identities are available. To use a system-assigned managed identity, you must first create the account and then enable customer-managed keys, because the system-assigned managed identity can exist only after the account is created. For more information on system-assigned versus user-assigned managed identities, see [Managed identities for Azure resources](../../active-directory/managed-identities-azure-resources/overview.md).
69
69
70
70
You can switch between customer-managed keys and Microsoft-managed keys at any time. For more information about Microsoft-managed keys, see [About encryption key management](storage-service-encryption.md#about-encryption-key-management).
71
71
72
72
To learn how to configure Azure Storage encryption with customer-managed keys in a key vault, see [Configure encryption with customer-managed keys stored in Azure Key Vault](customer-managed-keys-configure-key-vault.md). To configure customer-managed keys in a managed HSM, see [Configure encryption with customer-managed keys stored in Azure Key Vault Managed HSM](customer-managed-keys-configure-key-vault-hsm.md).
73
73
74
74
> [!IMPORTANT]
75
-
> Customer-managed keys rely on managed identities for Azure resources, a feature of Azure AD. Managed identities do not currently support cross-directory scenarios. When you configure customer-managed keys in the Azure portal, a managed identity is automatically assigned to your storage account under the covers. If you subsequently move the subscription, resource group, or storage account from one Azure AD directory to another, the managed identity associated with the storage account is not transferred to the new tenant, so customer-managed keys may no longer work. For more information, see **Transferring a subscription between Azure AD directories** in [FAQs and known issues with managed identities for Azure resources](../../active-directory/managed-identities-azure-resources/known-issues.md#transferring-a-subscription-between-azure-ad-directories).
75
+
> Customer-managed keys rely on managed identities for Azure resources, a feature of Azure AD. Managed identities do not currently support cross-tenant scenarios. When you configure customer-managed keys in the Azure portal, a managed identity is automatically assigned to your storage account under the covers. If you subsequently move the subscription, resource group, or storage account from one Azure AD tenant to another, the managed identity associated with the storage account is not transferred to the new tenant, so customer-managed keys may no longer work. For more information, see **Transferring a subscription between Azure AD directories** in [FAQs and known issues with managed identities for Azure resources](../../active-directory/managed-identities-azure-resources/known-issues.md#transferring-a-subscription-between-azure-ad-directories).
76
76
77
77
Azure storage encryption supports RSA and RSA-HSM keys of sizes 2048, 3072 and 4096. For more information about keys, see [About keys](../../key-vault/keys/about-keys.md).
0 commit comments