Customer-managed keys (CMKs) for Microsoft Foundry
This article refers to the Microsoft Foundry (new) portal.
- Encryption models and access control methods like Azure role-based access control (RBAC) and vault access policies.
- Ensuring compatibility with system-assigned managed identities and user-assigned managed identities.
Benefits of CMKs
- The ability to use your own keys to encrypt data at rest.
- Integration with organizational security and compliance policies.
- The ability to rotate or revoke keys for enhanced control over access to encrypted data.
Prerequisites
To configure a CMK for Foundry, you need:- An active Azure subscription to create and manage Azure resources.
-
An existing key vault to store your keys. These requirements also apply:
- Deploy the key vault and the Foundry resource in the same Azure region.
- Enable soft delete and purge protection on the key vault to help safeguard customer-managed keys from accidental or malicious deletion (required by Azure). To create a key vault, see Quickstart: Create a key vault by using the Azure portal.
-
A managed identity configuration:
- A system-assigned managed identity enabled for your Foundry resource.
- A user-assigned managed identity. See Create a user-assigned managed identity.
-
Key Vault permissions:
- If you’re using Azure RBAC, assign the Key Vault Crypto User role to the managed identity.
- If you’re using vault access policies, grant key-specific permissions to the managed identity, such as
unwrapKeyandwrapKey.
Steps to configure a CMK
Step 1: Create or import a key in the key vault
To generate a key:- In the Azure portal, go to your key vault.
- Under Settings, select Keys.
- Select + Generate/Import.
- Enter a key name, choose the key type (such as RSA or HSM-backed), and configure key size and expiration details.
- Select Create to save the new key.
- Projects can be updated from Microsoft-managed keys to CMKs but not reverted.
- Project CMKs can be updated only to keys in the same key vault.
- Storage-related charges for CMK encryption continue during soft-deleted retention.
- In your key vault, go to the Keys section.
- Select + Generate/Import, and then choose the Import option.
- Upload the key material and provide the necessary details for key configuration.
- Follow the prompts to complete the import process.
Step 2: Grant key vault permissions to managed identities
Configure appropriate permissions for the system-assigned or user-assigned managed identity to access the key vault:- In the Azure portal, go to your key vault.
- Select Access Control (IAM).
- Select + Add role assignment.
- Assign the Key Vault Crypto User role to the system-assigned managed identity of the Foundry resource or to the user-assigned managed identity.
Step 3: Enable the CMK in Foundry
You can enable CMKs either during the creation of a Foundry resource or by updating an existing resource. During resource creation, the wizard guides you to use a user-assigned or system-assigned managed identity. It also guides you to select a key vault where your key is stored. If you’re updating an existing Foundry resource, use these steps to enable a CMK:- In the Azure portal, open the Foundry resource.
- Go to Resource Management > Encryption.
- Select Customer-Managed Keys as the encryption type.
- Enter the key vault URL and the key name.
Vault access: Azure RBAC vs. vault access policies
Azure Key Vault supports two models for managing access permissions:-
Azure RBAC (recommended):
- Provides centralized access control by using Microsoft Entra roles.
- Simplifies permission management for resources across Azure.
- Requires the Key Vault Crypto User role.
-
Vault access policies:
- Allow granular access control specific to Key Vault resources.
- Are suitable for configurations where legacy or isolated permission settings are necessary.
Monitoring and rotating keys
To maintain optimal security and compliance, implement the following practices:- Enable Key Vault diagnostics: Monitor key usage and access activity by enabling diagnostic logging in Azure Monitor or Log Analytics.
- Rotate keys regularly: Periodically create a new version of your key in Key Vault. Update the Foundry resource to reference the latest key version in its encryption settings.