Configure customer-managed keys in the same tenant for an existing storage account - Azure Storage (2024)

  • Article

Azure Storage encrypts all data in a storage account at rest. By default, data is encrypted with Microsoft-managed keys. For more control over encryption keys, you can manage your own keys. Customer-managed keys must be stored in Azure Key Vault or Key Vault Managed Hardware Security Model (HSM).

This article shows how to configure encryption with customer-managed keys for an existing storage account when the storage account and key vault are in the same tenant. The customer-managed keys are stored in a key vault.

To learn how to configure customer-managed keys for a new storage account, see Configure customer-managed keys in an Azure key vault for an new storage account.

To learn how to configure encryption with customer-managed keys stored in a managed HSM, see Configure encryption with customer-managed keys stored in Azure Key Vault Managed HSM.

Note

Azure Key Vault and Azure Key Vault Managed HSM support the same APIs and management interfaces for configuration of customer-managed keys. Any action that is supported for Azure Key Vault is also supported for Azure Key Vault Managed HSM.

Configure the key vault

You can use a new or existing key vault to store customer-managed keys. The storage account and key vault may be in different regions or subscriptions in the same tenant. To learn more about Azure Key Vault, see Azure Key Vault Overview and What is Azure Key Vault?.

Using customer-managed keys with Azure Storage encryption requires that both soft delete and purge protection be enabled for the key vault. Soft delete is enabled by default when you create a new key vault and cannot be disabled. You can enable purge protection either when you create the key vault or after it is created.

Azure Key Vault supports authorization with Azure RBAC via an Azure RBAC permission model. Microsoft recommends using the Azure RBAC permission model over key vault access policies. For more information, see Grant permission to applications to access an Azure key vault using Azure RBAC.

  • Azure portal
  • PowerShell
  • Azure CLI

To learn how to create a key vault with the Azure portal, see Quickstart: Create a key vault using the Azure portal. When you create the key vault, select Enable purge protection, as shown in the following image.

Configure customer-managed keys in the same tenant for an existing storage account - Azure Storage (1)

To enable purge protection on an existing key vault, follow these steps:

  1. Navigate to your key vault in the Azure portal.
  2. Under Settings, choose Properties.
  3. In the Purge protection section, choose Enable purge protection.

Add a key

Next, add a key to the key vault. Before you add the key, make sure that you have assigned to yourself the Key Vault Crypto Officer role.

Azure Storage encryption supports RSA and RSA-HSM keys of sizes 2048, 3072 and 4096. For more information about supported key types, see About keys.

  • Azure portal
  • PowerShell
  • Azure CLI

To learn how to add a key with the Azure portal, see Quickstart: Set and retrieve a key from Azure Key Vault using the Azure portal.

Choose a managed identity to authorize access to the key vault

When you enable customer-managed keys for an existing storage account, you must specify a managed identity to be used to authorize access to the key vault that contains the key. The managed identity must have permissions to access the key in the key vault.

The managed identity that authorizes access to the key vault can be either a user-assigned or system-assigned managed identity. To learn more about system-assigned versus user-assigned managed identities, see Managed identity types.

Use a user-assigned managed identity to authorize access

When you enable customer-managed keys for a new storage account, you must specify a user-assigned managed identity. An existing storage account supports using either a user-assigned managed identity or a system-assigned managed identity to configure customer-managed keys.

When you configure customer-managed keys with a user-assigned managed identity, the user-assigned managed identity is used to authorize access to the key vault that contains the key. You must create the user-assigned identity before you configure customer-managed keys.

A user-assigned managed identity is a standalone Azure resource. To learn more about user-assigned managed identities, see Managed identity types. To learn how to create and manage a user-assigned managed identity, see Manage user-assigned managed identities.

The user-assigned managed identity must have permissions to access the key in the key vault. Assign the Key Vault Crypto Service Encryption User role to the user-assigned managed identity with key vault scope to grant these permissions.

  • Azure portal
  • PowerShell
  • Azure CLI

Before you can configure customer-managed keys with a user-assigned managed identity, you must assign the Key Vault Crypto Service Encryption User role to the user-assigned managed identity, scoped to the key vault. This role grants the user-assigned managed identity permissions to access the key in the key vault. For more information on assigning Azure RBAC roles with the Azure portal, see Assign Azure roles using the Azure portal.

When you configure customer-managed keys with the Azure portal, you can select an existing user-assigned identity through the portal user interface.

Use a system-assigned managed identity to authorize access

A system-assigned managed identity is associated with an instance of an Azure service, in this case an Azure Storage account. You must explicitly assign a system-assigned managed identity to a storage account before you can use the system-assigned managed identity to authorize access to the key vault that contains your customer-managed key.

Only existing storage accounts can use a system-assigned identity to authorize access to the key vault. New storage accounts must use a user-assigned identity, if customer-managed keys are configured on account creation.

The system-assigned managed identity must have permissions to access the key in the key vault. Assign the Key Vault Crypto Service Encryption User role to the system-assigned managed identity with key vault scope to grant these permissions.

  • Azure portal
  • PowerShell
  • Azure CLI

Before you can configure customer-managed keys with a system-assigned managed identity, you must assign the Key Vault Crypto Service Encryption User role to the system-assigned managed identity, scoped to the key vault. This role grants the system-assigned managed identity permissions to access the key in the key vault. For more information on assigning Azure RBAC roles with the Azure portal, see Assign Azure roles using the Azure portal.

When you configure customer-managed keys with the Azure portal with a system-assigned managed identity, the system-assigned managed identity is assigned to the storage account for you under the covers.

Configure customer-managed keys for an existing account

When you configure encryption with customer-managed keys for an existing storage account, you can choose to automatically update the key version used for Azure Storage encryption whenever a new version is available in the associated key vault. Alternately, you can explicitly specify a key version to be used for encryption until the key version is manually updated.

When the key version is changed, whether automatically or manually, the protection of the root encryption key changes, but the data in your Azure Storage account remains encrypted at all times. There's no further action required on your part to ensure that your data is protected. Rotating the key version doesn't impact performance. There's no downtime associated with rotating the key version.

You can use either a system-assigned or user-assigned managed identity to authorize access to the key vault when you configure customer-managed keys for an existing storage account.

Note

To rotate a key, create a new version of the key in Azure Key Vault. Azure Storage does not handle key rotation, so you will need to manage rotation of the key in the key vault. You can configure key auto-rotation in Azure Key Vault or rotate your key manually.

Configure encryption for automatic updating of key versions

Azure Storage can automatically update the customer-managed key that is used for encryption to use the latest key version from the key vault. Azure Storage checks the key vault daily for a new version of the key. When a new version becomes available, then Azure Storage automatically begins using the latest version of the key for encryption.

Important

Azure Storage checks the key vault for a new key version only once daily. When you rotate a key, be sure to wait 24 hours before disabling the older version.

  • Azure portal
  • PowerShell
  • Azure CLI

To configure customer-managed keys for an existing account with automatic updating of the key version in the Azure portal, follow the steps below:

  1. Navigate to your storage account.

  2. Under Security + networking, select Encryption. By default, key management is set to Microsoft-Managed Keys as shown in the image below:

  3. Select the Customer-Managed Keys option. If the account was previously configured for Customer-Managed Keys with manual updating of the key version, select Change key near the bottom of the page.

  4. Choose the Select from Key Vault option.

  5. Select Select a key vault and key.

  6. Select the key vault containing the key you want to use. You can also create a new key vault.

  7. Select the key from the key vault. You can also create a new key.

    Configure customer-managed keys in the same tenant for an existing storage account - Azure Storage (3)

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

    1. If you select System-assigned, the system-assigned managed identity for the storage account is created under the covers, if it doesn't already exist.
    2. 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.

    Configure customer-managed keys in the same tenant for an existing storage account - Azure Storage (4)

  9. Save your changes.

After you specify 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. The portal also displays the type of managed identity used to authorize access to the key vault and the principal ID for the managed identity.

Configure customer-managed keys in the same tenant for an existing storage account - Azure Storage (5)

Configure encryption for manual updating of key versions

If you prefer to manually update the key version, then explicitly specify the version at the time that you configure encryption with customer-managed keys. In this case, Azure Storage won't automatically update the key version when a new version is created in the key vault. To use a new key version, you must manually update the version used for Azure Storage encryption.

  • Azure portal
  • PowerShell
  • Azure CLI

To configure customer-managed keys with manual updating of the key version in the Azure portal, specify the key URI, including the version. To specify a key as a URI, follow these steps:

  1. To locate the key URI in the Azure portal, navigate to your key vault, and select the Keys setting. Select the desired key, then select the key to view its versions. Select a key version to view the settings for that version.

  2. Copy the value of the Key Identifier field, which provides the URI.

    Configure customer-managed keys in the same tenant for an existing storage account - Azure Storage (6)

  3. In the Encryption key settings for your storage account, choose the Enter key URI option.

  4. Paste the URI that you copied into the Key URI field. Omit the key version from the URI to enable automatic updating of the key version.

    Configure customer-managed keys in the same tenant for an existing storage account - Azure Storage (7)

  5. Specify the subscription that contains the key vault.

  6. Specify either a system-assigned or user-assigned managed identity.

  7. Save your changes.

Change the key

You can change the key that you are using for Azure Storage encryption at any time.

Note

When you change the key or key version, the protection of the root encryption key changes, but the data in your Azure Storage account remains encrypted at all times. There is no additional action required on your part to ensure that your data is protected. Changing the key or rotating the key version doesn't impact performance. There is no downtime associated with changing the key or rotating the key version.

  • Azure portal
  • PowerShell
  • Azure CLI

To change the key with the Azure portal, follow these steps:

  1. Navigate to your storage account and display the Encryption settings.
  2. Select the key vault and choose a new key.
  3. Save your changes.

If the new key is in a different key vault, you must grant the managed identity access to the key in the new vault. If you opt for manual updating of the key version, you also need to update the key vault URI.

Revoke access to a storage account that uses customer-managed keys

To temporarily revoke access to a storage account that is using customer-managed keys, disable the key currently being used in the key vault. There is no performance impact or downtime associated with disabling and reenabling the key.

After the key has been disabled, clients can't call operations that read from or write to a blob or its metadata. For information about which operations will fail, see Revoke access to a storage account that uses customer-managed keys.

Caution

When you disable the key in the key vault, the data in your Azure Storage account remains encrypted, but it becomes inaccessible until you reenable the key.

  • Azure portal
  • PowerShell
  • Azure CLI

To disable a customer-managed key with the Azure portal, follow these steps:

  1. Navigate to the key vault that contains the key.

  2. Under Objects, select Keys.

  3. Right-click the key and select Disable.

    Configure customer-managed keys in the same tenant for an existing storage account - Azure Storage (8)

Switch back to Microsoft-managed keys

You can switch from customer-managed keys back to Microsoft-managed keys at any time, using the Azure portal, PowerShell, or the Azure CLI.

  • Azure portal
  • PowerShell
  • Azure CLI

To switch from customer-managed keys back to Microsoft-managed keys in the Azure portal, follow these steps:

  1. Navigate to your storage account.

  2. Under Security + networking, select Encryption.

  3. Change Encryption type to Microsoft-managed keys.

    Configure customer-managed keys in the same tenant for an existing storage account - Azure Storage (9)

Next steps

  • Azure Storage encryption for data at rest
  • Customer-managed keys for Azure Storage encryption
  • Configure customer-managed keys in an Azure key vault for a new storage account
Configure customer-managed keys in the same tenant for an existing storage account - Azure Storage (2024)

FAQs

How do you configure customer-managed keys? ›

When you enable customer-managed keys for an existing storage account, you must specify a managed identity to be used to authorize access to the key vault that contains the key. The managed identity must have permissions to access the key in the key vault.

What is required before using customer-managed keys to encrypt Microsoft Azure storage accounts? ›

Key vault requirements

The key vault or managed HSM that stores the key must have both soft delete and purge protection enabled. Azure storage encryption supports RSA and RSA-HSM keys of sizes 2048, 3072 and 4096.

How many storage account access keys exist for each storage account by default? ›

When you create a storage account, Azure generates two 512-bit storage account access keys for that account. These keys can be used to authorize access to data in your storage account via Shared Key authorization, or via SAS tokens that are signed with the shared key.

How do I assign a managed identity to my Azure storage account? ›

In this example, we are giving an Azure virtual machine access to a storage account, so we navigate to the storage account. Select Access control (IAM). Select Add > Add role assignment to open the Add role assignment page. Select the role and managed identity.

What is customer managed keys? ›

Customer-managed encryption keys are encryption keys that you manage using Cloud KMS. This functionality lets you have greater control over the keys used to encrypt data at rest within supported Google Cloud services. To learn whether a service supports CMEK keys, see the list of supported services.

How do I create a customer managed KMS key? ›

Procedure
  1. Navigate to the AWS Key Management Service KMS.
  2. On the left side panel of the AWS Console, navigate to KMS / Customer managed keys, and click Create key.
  3. Select Symmetric. ...
  4. Type an Alias for the KMS key, such as, s3-cmk-data-forwarder , and click Next.
Sep 9, 2022

How to create customer managed keys in Azure? ›

Go to Settings > Encryption, and select Customer managed key. Then select Select a key and key vault. On the Select key from Azure Key Vault screen, your subscription is automatically populated. For Key vault, you can select an existing key vault from the dropdown list or select Create new and create a new key vault.

Where should the cloud customer's encryption keys be stored? ›

These keys are created and managed using Cloud Key Management Service (Cloud KMS), and you store the keys as software keys, in an HSM cluster, or externally.

Why use Azure customer managed keys? ›

Customer-managed keys in Azure Monitor give you greater flexibility to manage access controls to logs. Once configure, new data ingested to linked workspaces gets encrypted with your key stored in Azure Key Vault, or Azure Key Vault Managed "HSM".

Why do Azure storage accounts have two access keys? ›

The reason behind two storage account keys is to regenerate the keys with no interruption to your storage service or access to that service. This mechanism is for seamlessly changing access keys without service interruption.

What is the difference between a storage account access key and a shared access signature? ›

Access keys give you full rights to everything in your storage account, but with SAS you're able to limit the access capabilities of its users. You can limit capabilities such as read, write or update or to containers, plus you can timebox when the signature is valid for.

What is the difference between managed identity and SAS key? ›

SAS tokens provide secure, delegated access to resources in your Azure storage account. Managed identities provide an alternate method for you to grant access to your storage data without the need to include SAS tokens with your HTTP requests. See, Managed identities for Document Translation.

How to connect to Azure Blob Storage using managed identity? ›

In the Assignment type tab, select Job function type and then Next. In the Role tab, select Storage Blob Data Contributor role from the dropdown and then select Next. In the Members tab, select Assign access to -> Managed identity and then select Members -> Select members.

How do I enable managed keys on AWS? ›

In the navigation pane, choose Customer managed keys. Choose the check box for the KMS keys that you want to enable or disable. To enable a KMS key, choose Key actions, Enable. To disable a KMS key, choose Key actions, Disable.

What is the difference between customer managed key and AWS managed keys? ›

Customer keys and AWS keys. The KMS keys that you create are customer managed keys. AWS services that use KMS keys to encrypt your service resources often create keys for you. KMS keys that AWS services create in your AWS account are AWS managed keys.

What is the difference between bring your own key and customer managed key? ›

Keys stored in a customer-owned key vault or hardware security module (HSM) are CMKs. Bring Your Own Key (BYOK) is a CMK scenario in which a customer imports (brings) keys from an outside storage location into an Azure key management service (see the Azure Key Vault: Bring your own key specification).

How do I edit managed keys in AWS? ›

You cannot edit any properties of AWS managed keys or AWS owned keys. These keys are managed by the AWS services that created them. You can change the description of your customer managed key on the details page for the KMS key or by using the UpdateKeyDescription operation.

Top Articles
Latest Posts
Article information

Author: Nicola Considine CPA

Last Updated:

Views: 5740

Rating: 4.9 / 5 (49 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Nicola Considine CPA

Birthday: 1993-02-26

Address: 3809 Clinton Inlet, East Aleisha, UT 46318-2392

Phone: +2681424145499

Job: Government Technician

Hobby: Calligraphy, Lego building, Worldbuilding, Shooting, Bird watching, Shopping, Cooking

Introduction: My name is Nicola Considine CPA, I am a determined, witty, powerful, brainy, open, smiling, proud person who loves writing and wants to share my knowledge and understanding with you.