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
title: Encryption-at-rest with customer-managed keys
2
+
title: Encryption-at-rest with a customer-managed key
3
3
description: Learn about encryption-at-rest of your Azure container registry, and how to encrypt your registry with a customer-managed key stored in Azure Key Vault
4
4
ms.topic: article
5
-
ms.date: 03/10/2020
5
+
ms.date: 05/01/2020
6
6
ms.custom:
7
7
---
8
8
9
-
# Encryption using customer-managed keys
9
+
# Encrypt registry using a customer-managed key
10
10
11
11
When you store images and other artifacts in an Azure container registry, Azure automatically encrypts the registry content at rest with [service-managed keys](../security/fundamentals/encryption-atrest.md#data-encryption-models). You can supplement default encryption with an additional encryption layer using a key that you create and manage in Azure Key Vault. This article walks you through the steps using the Azure CLI and the Azure portal.
12
12
13
-
Server-side encryption with customer-managed keys is supported through integration with [Azure Key Vault](../key-vault/general/overview.md). You can create your own encryption keys and store them in a key vault, or you can use Azure Key Vault's APIs to generate encryption keys. With Azure Key Vault, you can also audit key usage.
13
+
Server-side encryption with customer-managed keys is supported through integration with [Azure Key Vault](../key-vault/general/overview.md). You can create your own encryption keys and store them in a key vault, or use Azure Key Vault's APIs to generate keys. With Azure Key Vault, you can also audit key usage.
14
14
15
15
This feature is available in the **Premium** container registry service tier. For information about registry service tiers and limits, see [Azure Container Registry SKUs](container-registry-skus.md).
16
16
17
-
> [!IMPORTANT]
18
-
> This feature is currently in preview, and some [limitations](#preview-limitations) apply. Previews are made available to you on the condition that you agree to the [supplemental terms of use][terms-of-use]. Some aspects of this feature may change prior to general availability (GA).
19
-
>
20
17
21
-
## Preview limitations
18
+
## Things to know
22
19
23
-
* You can currently enable this feature only when you create a registry.
20
+
* You can currently enable a customer-managed key only when you create a registry.
24
21
* After enabling a customer-managed key on a registry, you can't disable it.
25
22
*[Content trust](container-registry-content-trust.md) is currently not supported in a registry encrypted with a customer-managed key.
26
23
* In a registry encrypted with a customer-managed key, run logs for [ACR Tasks](container-registry-tasks-overview.md) are currently retained for only 24 hours. If you need to retain logs for a longer period, see guidance to [export and store task run logs](container-registry-tasks-logs.md#alternative-log-storage).
@@ -135,12 +132,15 @@ In the command output, take note of the key's ID, `kid`. You use this ID in the
135
132
For convenience, store this value in an environment variable:
Run the [az acr create][az-acr-create] command to create a registry and enable the customer-managed key. Pass the managed identity principal ID and the key ID, stored previously in environment variables:
143
+
Run the [az acr create][az-acr-create] command to create a registry in the Premium service tier and enable the customer-managed key. Pass the managed identity principal ID and the key ID, stored previously in environment variables:
144
144
145
145
```azurecli
146
146
az acr create \
@@ -159,21 +159,34 @@ To show whether registry encryption with a customer-managed key is enabled, run
Create a user-assigned [managed identity for Azure resources](../active-directory/managed-identities-azure-resources/overview.md) in the Azure portal. For steps, see [Create a user-assigned identity](../active-directory/managed-identities-azure-resources/how-to-manage-ua-identity-portal.md#create-a-user-assigned-managed-identity).
167
180
168
-
Take note of the **Resource Name** of the managed identity. You need this name in later steps.
181
+
You use the identity's name in later steps.
169
182
170
183

171
184
172
185
### Create a key vault
173
186
174
187
For steps to create a key vault, see [Quickstart: Set and retrieve a secret from Azure Key Vault using the Azure portal](../key-vault/secrets/quick-create-portal.md).
175
188
176
-
When creating a key vault for a customer-managed key, in the **Basics** tab, you must enable the following protection settings: **Soft delete** and **Purge protection**. These settings help prevent data loss caused by accidental key or key vault deletions.
189
+
When creating a key vault for a customer-managed key, in the **Basics** tab, enable the following protection settings: **Soft delete** and **Purge protection**. These settings help prevent data loss caused by accidental key or key vault deletions.
177
190
178
191

179
192
@@ -203,14 +216,14 @@ Configure a policy for the key vault so that the identity can access it.
203
216
1. In the **Basics** tab, select or create a resource group, and enter a registry name. In **SKU**, select **Premium**.
204
217
1. In the **Encryption** tab, in **Customer-managed key**, select **Enabled**.
205
218
1. In **Identity**, select the managed identity you created.
206
-
1. In **Encryption key**, select **Select from Key Vault**.
219
+
1. In **Encryption**, select **Select from Key Vault**.
207
220
1. In the **Select key from Azure Key Vault** window, select the key vault, key, and version you created in the preceding section.
208
221
1. In the **Encryption** tab, select **Review + create**.
209
222
1. Select **Create** to deploy the registry instance.
210
223
211
224

212
225
213
-
To see the encryption status of your registry in the portal, navigate to your registry. Under **Settings**, select **Encryption (Preview)**.
226
+
To see the encryption status of your registry in the portal, navigate to your registry. Under **Settings**, select **Encryption**.
214
227
215
228
## Enable customer-managed key - template
216
229
@@ -342,38 +355,75 @@ az group deployment create \
342
355
343
356
### Show encryption status
344
357
345
-
To show the status of registry encryption, run the [az acr encryption show-status][az-acr-encryption-show-status] command:
358
+
To show the status of registry encryption, run the [az acr encryption show][az-acr-encryption-show] command:
346
359
347
360
```azurecli
348
-
az acr encryption show-status --name <registry-name>
361
+
az acr encryption show --name <registry-name>
349
362
```
350
363
351
364
## Use the registry
352
365
353
-
After you enable a registry to encrypt data using a customer-managed key, you can perform the same registry operations that you perform in a registry that's not encrypted with a customer-managed key. For example, you can authenticate with the registry and push Docker images. See example commands in [Push and pull an image](container-registry-get-started-docker-cli.md).
366
+
After enabling a customer-managed key in a registry, you can perform the same registry operations that you perform in a registry that's not encrypted with a customer-managed key. For example, you can authenticate with the registry and push Docker images. See example commands in [Push and pull an image](container-registry-get-started-docker-cli.md).
354
367
355
368
## Rotate key
356
369
357
-
You can rotate a customer-managed key in Azure Key Vault according to your compliance policies. Create a new key, and then update the registry to encrypt data using the new key. You can perform these steps using the Azure CLI or in the portal.
370
+
Rotate a customer-managed key used for registry encryption to your compliance policies. Create a new key, or update a key version, and then update the registry to encrypt data using the key. You can perform these steps using the Azure CLI or in the portal.
371
+
372
+
When rotating a key, typically you specify the same identity used when creating the registry. Optionally, configure a new user-assigned identity for key access, or enable and specify the registry's system-assigned identity.
373
+
374
+
> [!NOTE]
375
+
> Ensure that the required [key vault access policy](#add-key-vault-access-policy) is set for the identity you configure for key access.
376
+
377
+
### Azure CLI
358
378
359
-
For example, run the [az keyvault key create][az-keyvault-key-create] command to create a new key:
379
+
Use [az keyvault key][az-keyvault-key] commands to create or manage your key vault keys. For example, to create a new key version or key, run the [az keyvault key create][az-keyvault-key-create] command:
360
380
361
381
```azurecli
362
-
az keyvault key create –-name <new-key-name> --vault-name <key-vault-name>
382
+
# Create new version of existing key
383
+
az keyvault key create \
384
+
–-name <key-name> \
385
+
--vault-name <key-vault-name>
386
+
387
+
# Create new key
388
+
az keyvault key create \
389
+
–-name <new-key-name> \
390
+
--vault-name <key-vault-name>
363
391
```
364
392
365
-
Then run the [az acr encryption rotate-key][az-acr-encryption-rotate-key] command, passing the new key ID and the principal ID of the managed identity you previously configured:
393
+
Then run the [az acr encryption rotate-key][az-acr-encryption-rotate-key] command, passing the new key ID and the identity you want to configure:
366
394
367
395
```azurecli
368
-
az acr encryption rotatekey \
396
+
# Rotate key and use user-assigned identity
397
+
az acr encryption rotate-key \
369
398
--name <registry-name> \
370
399
--key-encryption-key <new-key-id> \
371
-
--identity $identityPrincipalID
400
+
--identity <principal-id-user-assigned-identity>
401
+
402
+
# Rotate key and use system-assigned identity
403
+
az acr encryption rotate-key \
404
+
--name <registry-name> \
405
+
--key-encryption-key <new-key-id> \
406
+
--identity [system]
372
407
```
373
408
409
+
### Portal
410
+
411
+
Use the registry's **Encryption** settings to update the key version, key, key vault, or identity settings used for the customer-managed key.
412
+
413
+
For example, to generate and configure a new key version:
414
+
415
+
1. In the portal, navigate to your registry.
416
+
1. Under **Settings**, select **Encryption** > **Change key**.
417
+
1. Select **Select key**
418
+
419
+

420
+
1. In the **Select key from Azure Key Vault** window, select the key vault and key you configured previously, and in **Version**, select **Create new**.
421
+
1. In the **Create a key** window, select **Generate**, and then **Create**.
422
+
1. Complete the key selection and select **Save**.
423
+
374
424
## Revoke key
375
425
376
-
Revoke the customer-managed encryption key by changing the access policy on the key vault or by deleting the key. For example, use the [az keyvault delete-policy][az-keyvault-delete-policy] command to change the access policy of the managed identity used by your registry. For example:
426
+
Revoke the customer-managed encryption key by changing the access policy on the key vault or by deleting the key. For example, use the [az keyvault delete-policy][az-keyvault-delete-policy] command to change the access policy of the managed identity used by your registry:
377
427
378
428
```azurecli
379
429
az keyvault delete-policy \
@@ -384,15 +434,49 @@ az keyvault delete-policy \
384
434
385
435
Revoking the key effectively blocks access to all registry data, since the registry can't access the encryption key. If access to the key is enabled or the deleted key is restored, your registry will pick the key so you can again access the encrypted registry data.
386
436
437
+
## Advanced scenarios
438
+
439
+
### System-assigned identity
440
+
441
+
You can configure a registry's system-assigned managed identity to access the key vault for encryption keys. If you're unfamiliar with the different managed identities for Azure resources, see the [overview](../active-directory/managed-identities-azure-resources/overview.md).
442
+
443
+
To enable the registry's system-assigned identity in the portal:
444
+
445
+
1. In the portal, navigate to your registry.
446
+
1. Select **Settings** > **Identity**.
447
+
1. Under **System assigned**, set **Status** to **On**. Select **Save**.
Copy file name to clipboardExpand all lines: articles/key-vault/general/overview-vnet-service-endpoints.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,6 +73,7 @@ Here's a list of trusted services that are allowed to access a key vault if the
73
73
|Azure Event Hubs|[Allow access to a key vault for customer-managed keys scenario](https://docs.microsoft.com/azure/event-hubs/configure-customer-managed-key)|
74
74
|Azure Service Bus|[Allow access to a key vault for customer-managed keys scenario](https://docs.microsoft.com/azure/service-bus-messaging/configure-customer-managed-key)|
75
75
|Azure Import/Export| [Use customer-managed keys in Azure Key Vault for Import/Export service](https://docs.microsoft.com/azure/storage/common/storage-import-export-encryption-key-portal)
76
+
|Azure Container Registry|[Registry encryption using customer-managed keys](../../container-registry/container-registry-customer-managed-keys.md)
76
77
77
78
> [!NOTE]
78
79
> You must set up the relevant Key Vault access policies to allow the corresponding services to get access to Key Vault.
0 commit comments