Skip to content

Commit eacc984

Browse files
Merge pull request #218491 from msmbaldwin/key-migration
How to migrate key workloads between Azure Key Vault and Azure Managed HSM
2 parents 253b469 + eb90cf0 commit eacc984

File tree

2 files changed

+66
-7
lines changed

2 files changed

+66
-7
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
title: How to migrate key workloads
3+
description: How to migrate key workloads
4+
author: msmbaldwin
5+
ms.author: mbaldwin
6+
services: key-vault
7+
ms.topic: conceptual
8+
ms.service: key-vault
9+
ms.subservice: managed-hsm
10+
ms.date: 11/15/2022
11+
---
12+
13+
# How to migrate key workloads
14+
15+
Azure Key Vault and Azure Managed HSM do not allow the export of keys, to protect the key material and ensure that the HSM properties of the keys can't be changed.
16+
17+
If you want a key to be highly portable, it is best to create it in a supported HSM and import it into Azure Key Vault or Azure Managed HSM.
18+
19+
> [!NOTE]
20+
> The only exception is if a key is created with a [key release policy](../keys/policy-grammar.md) restricting exports to confidential compute enclaves you trust to handle the key material. Such secure key operations are not general-purpose exports of the key.
21+
22+
There are several scenarios that require the migration of key workloads:
23+
- Switching security boundaries, such as when switching between subscriptions, resource groups, or owners.
24+
- Moving regions due to compliance boundaries or risks in a given region.
25+
- Changing to a new offering, such as from Azure Key Vault to [Azure Managed HSM](../managed-hsm/overview.md), which offers greater security, isolation, and compliance than Key Vault Premium.
26+
27+
Below we discuss several methods for migrating workloads to use a new key, either into a new vault or into a new managed HSM.
28+
29+
## Azure Services using customer-managed key
30+
31+
For most workloads that use keys in Key Vault, the most effective way to migrate a key into a new location (a new managed HSM or new key vault in a different subscription or region) is to:
32+
33+
1. Create a new key in the new vault or managed HSM.
34+
1. Ensure that the workload has access to this new key, by adding the workload's identity to the appropriate role in [Azure Key Vault](rbac-guide.md) or [Azure Managed HSM](../managed-hsm/access-control.md).
35+
1. Update the workload to use the new key as the customer managed encryption key.
36+
1. Retain the old key until you no longer want the backups of the workload data that they key originally protected.
37+
38+
For example, to update Azure Storage to use a new key, follow the instructions at [Configure customer-managed keys for an existing storage account - Azure Storage](../../storage/common/customer-managed-keys-configure-existing-account.md). The previous customer managed key is needed until Storage is updated to the new key; once Storage has successfully been updated to the new key, the previous key is no longer needed.
39+
40+
## Custom applications and client-side encryption
41+
42+
For client-side encryption or custom applications you've built, that directly encrypt data using the keys in Key Vault, the process is different:
43+
44+
1. Create the new key vault or managed HSM, and create a new key encryption key (KEK).
45+
1. Re-encrypt any keys or data that was encrypted by the old key using the new key. (If data was directly encrypted by the key in key vault, this may take some time, as all data must be read, decrypted, and encrypted with the new key. Use [envelope encryption](../../security/fundamentals/encryption-atrest.md#envelope-encryption-with-a-key-hierarchy) where possible to make such key rotations faster).
46+
47+
When re-encrypting the data, we recommend a three-level key hierarchy, which will make KEK rotation easier in the future:
48+
1. The Key Encryption Key in Azure Key Vault or Managed HSM
49+
1. The Primary Key
50+
1. Data Encryption Keys derived from the Primary Key
51+
1. Verify data after migration (and before deletion).
52+
1. Do not delete old key/key vault until you no longer want the backups of data associated with it.
53+
54+
## Migrating tenant keys in Azure Information Protection
55+
Migrating tenant keys in Azure Information Protection is referred to as "rekeying" or "rolling your key". [Customer-managed - AIP tenant key life cycle operations](/azure/information-protection/operations-customer-managed-tenant-key#rekey-your-tenant-key) has detailed instructions on how to perform this operation.
56+
57+
It is not safe to delete the old tenant key until you no longer need the content or documents protected with the old tenant key. If you want to migrate documents to be protected by the new key, you must:
58+
59+
1. Remove protection from the document protected with the old tenant key.
60+
1. Apply protection again, which will use the new tenant key.
61+
62+
## Next steps
63+
64+
- [About Azure Key Vault](overview.md)
65+
- [About Azure Key Vault Managed HSM?](../managed-hsm/overview.md)
66+
- [Key management is Azure](../../security/fundamentals/key-management.md)

articles/key-vault/managed-hsm/best-practices.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,6 @@ Managed HSM is a cloud service that safeguards encryption keys. As these keys ar
3737
- [Soft Delete](soft-delete-overview.md) is on by default. You can choose a retention period between 7 and 90 days.
3838
- Turn on purge protection to prevent immediate permanent deletion of HSM or keys. When purge protection is on HSM or keys will remain in deleted state until the retention days have passed.
3939

40-
## Generate and import keys from on-premises HSM
41-
42-
> [!NOTE]
43-
> Keys created or imported into Managed HSM are not exportable.
44-
45-
- To ensure long term portability and key durability, generate keys in your on-premises HSM and [import them to Managed HSM](hsm-protected-keys-byok.md). You will have a copy of your key securely stored in your on-premises HSM for future use.
46-
4740
## Next steps
4841

4942
- See [Full backup/restore](backup-restore.md) for information on full HSM backup/restore.

0 commit comments

Comments
 (0)