Skip to content

Commit de44d33

Browse files
authored
Merge pull request #109947 from dlepow/acrcmk
[ACR] CMK GA
2 parents 80d05c5 + d350d22 commit de44d33

File tree

4 files changed

+117
-31
lines changed

4 files changed

+117
-31
lines changed

articles/container-registry/TOC.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,12 @@
8787
href: container-registry-webhook.md
8888
- name: Security and authentication
8989
items:
90-
- name: Limit access with virtual network (preview)
91-
href: container-registry-vnet.md
9290
- name: Integrate with Azure Private Link (preview)
9391
href: container-registry-private-link.md
92+
- name: Limit access with virtual network (preview)
93+
href: container-registry-vnet.md
94+
- name: Encrypt with customer-managed key
95+
href: container-registry-customer-managed-keys.md
9496
- name: Access behind a firewall
9597
href: container-registry-firewall-access-rules.md
9698
- name: Authentication
@@ -115,8 +117,6 @@
115117
href: container-registry-content-trust.md
116118
- name: Image scanning with Security Center
117119
href: ../security-center/azure-container-registry-integration.md?toc=/azure/container-registry/toc.json&bc=/azure/container-registry/breadcrumb/toc.json
118-
- name: Encrypt registry data (preview)
119-
href: container-registry-customer-managed-keys.md
120120
- name: Registries and other Azure services
121121
expanded: false
122122
items:

articles/container-registry/container-registry-customer-managed-keys.md

Lines changed: 112 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
---
2-
title: Encryption-at-rest with customer-managed keys
2+
title: Encryption-at-rest with a customer-managed key
33
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
44
ms.topic: article
5-
ms.date: 03/10/2020
5+
ms.date: 05/01/2020
66
ms.custom:
77
---
88

9-
# Encryption using customer-managed keys
9+
# Encrypt registry using a customer-managed key
1010

1111
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.
1212

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.
1414

1515
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).
1616

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-
>
2017

21-
## Preview limitations
18+
## Things to know
2219

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.
2421
* After enabling a customer-managed key on a registry, you can't disable it.
2522
* [Content trust](container-registry-content-trust.md) is currently not supported in a registry encrypted with a customer-managed key.
2623
* 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
135132
For convenience, store this value in an environment variable:
136133

137134
```azurecli
138-
keyID=$(az keyvault key show --name <keyname> --vault-name <key-vault-name> --query 'key.kid' --output tsv)
135+
keyID=$(az keyvault key show \
136+
--name <keyname> \
137+
--vault-name <key-vault-name> \
138+
--query 'key.kid' --output tsv)
139139
```
140140

141141
### Create a registry with customer-managed key
142142

143-
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:
144144

145145
```azurecli
146146
az acr create \
@@ -159,21 +159,34 @@ To show whether registry encryption with a customer-managed key is enabled, run
159159
az acr encryption show --name <registry-name>
160160
```
161161

162+
Output is similar to:
163+
164+
```console
165+
{
166+
"keyVaultProperties": {
167+
"identity": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
168+
"keyIdentifier": "https://myvault.vault.azure.net/keys/myresourcegroup/abcdefg123456789...",
169+
"versionedKeyIdentifier": "https://myvault.vault.azure.net/keys/myresourcegroup/abcdefg123456789..."
170+
},
171+
"status": "enabled"
172+
}
173+
```
174+
162175
## Enable customer-managed key - portal
163176

164177
### Create a managed identity
165178

166179
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).
167180

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.
169182

170183
![Create user-assigned managed identity in the Azure portal](./media/container-registry-customer-managed-keys/create-managed-identity.png)
171184

172185
### Create a key vault
173186

174187
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).
175188

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.
177190

178191
![Create key vault in the Azure portal](./media/container-registry-customer-managed-keys/create-key-vault.png)
179192

@@ -203,14 +216,14 @@ Configure a policy for the key vault so that the identity can access it.
203216
1. In the **Basics** tab, select or create a resource group, and enter a registry name. In **SKU**, select **Premium**.
204217
1. In the **Encryption** tab, in **Customer-managed key**, select **Enabled**.
205218
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**.
207220
1. In the **Select key from Azure Key Vault** window, select the key vault, key, and version you created in the preceding section.
208221
1. In the **Encryption** tab, select **Review + create**.
209222
1. Select **Create** to deploy the registry instance.
210223

211224
![Create container registry in the Azure portal](./media/container-registry-customer-managed-keys/create-encrypted-registry.png)
212225

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**.
214227

215228
## Enable customer-managed key - template
216229

@@ -342,38 +355,75 @@ az group deployment create \
342355

343356
### Show encryption status
344357

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:
346359

347360
```azurecli
348-
az acr encryption show-status --name <registry-name>
361+
az acr encryption show --name <registry-name>
349362
```
350363

351364
## Use the registry
352365

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).
354367

355368
## Rotate key
356369

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
358378

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:
360380

361381
```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>
363391
```
364392

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:
366394

367395
```azurecli
368-
az acr encryption rotatekey \
396+
# Rotate key and use user-assigned identity
397+
az acr encryption rotate-key \
369398
--name <registry-name> \
370399
--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]
372407
```
373408

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+
![Rotate key in the Azure portal](./media/container-registry-customer-managed-keys/rotate-key.png)
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+
374424
## Revoke key
375425

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:
377427

378428
```azurecli
379429
az keyvault delete-policy \
@@ -384,15 +434,49 @@ az keyvault delete-policy \
384434

385435
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.
386436

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**.
448+
1. Copy the **Object ID** of the identity.
449+
450+
To grant the identity access to your key vault:
451+
452+
1. Navigate to your key vault.
453+
1. Select **Settings** > **Access policies > +Add Access Policy**.
454+
1. Select **Key permissions**, and select **Get**, **Unwrap Key**, and **Wrap Key**.
455+
1. Select **Select principal** and search for the object ID of your system-assigned managed identity, or the name of your registry.
456+
1. Select **Add**, then select **Save**.
457+
458+
To update the registry's encryption settings to use the identity:
459+
460+
1. In the portal, navigate to your registry.
461+
1. Under **Settings**, select **Encryption** > **Change key**.
462+
1. In **Identity**, select **System assigned**, and select **Save**.
463+
464+
### Key Vault firewall
465+
466+
If your Azure key vault is deployed in a virtual network with a Key Vault firewall, perform the following steps:
467+
468+
1. Configure registry encryption to use the registry's system-assigned identity. See the preceding section.
469+
2. Configure the key vault to allow access by any [trusted service](../key-vault/general/overview-vnet-service-endpoints.md#trusted-services).
470+
471+
For detailed steps, see [Configure Azure Key Vault firewalls and virtual networks](../key-vault/general/network-security.md).
472+
387473
## Next steps
388474

389475
* Learn more about [encryption at rest in Azure](../security/fundamentals/encryption-atrest.md).
390476
* Learn more about access policies and how to [secure access to a key vault](../key-vault/general/secure-your-key-vault.md).
391-
* To provide feedback on customer-managed keys for Azure Container Registry, visit the [ACR GitHub site](https://aka.ms/acr/issues).
392477

393478

394479
<!-- LINKS - external -->
395-
[terms-of-use]: https://azure.microsoft.com/support/legal/preview-supplemental-terms
396480

397481
<!-- LINKS - internal -->
398482

@@ -404,6 +488,7 @@ Revoking the key effectively blocks access to all registry data, since the regis
404488
[az-group-deployment-create]: /cli/azure/group/deployment#az-group-deployment-create
405489
[az-keyvault-create]: /cli/azure/keyvault#az-keyvault-create
406490
[az-keyvault-key-create]: /cli/azure/keyvault/key#az-keyvault-key-create
491+
[az-keyvault-key]: /cli/azure/keyvault/key
407492
[az-keyvault-set-policy]: /cli/azure/keyvault#az-keyvault-set-policy
408493
[az-keyvault-delete-policy]: /cli/azure/keyvault#az-keyvault-delete-policy
409494
[az-resource-show]: /cli/azure/resource#az-resource-show
78.9 KB
Loading

articles/key-vault/general/overview-vnet-service-endpoints.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ Here's a list of trusted services that are allowed to access a key vault if the
7373
|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)|
7474
|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)|
7575
|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)
7677

7778
> [!NOTE]
7879
> You must set up the relevant Key Vault access policies to allow the corresponding services to get access to Key Vault.

0 commit comments

Comments
 (0)