Skip to content

Latest commit

 

History

History
419 lines (324 loc) · 24.2 KB

File metadata and controls

419 lines (324 loc) · 24.2 KB
title Configure customer-managed keys for Azure NetApp Files volume encryption
description Describes how to configure customer-managed keys for Azure NetApp Files volume encryption.
services azure-netapp-files
author b-ahibbard
ms.service azure-netapp-files
ms.topic how-to
ms.date 06/20/2025
ms.author anfdocs
ms.custom
devx-track-azurecli
devx-track-azurepowershell
sfi-image-nochange

Configure customer-managed keys for Azure NetApp Files volume encryption

Customer-managed keys for Azure NetApp Files volume encryption enable you to use your own keys rather than a platform-managed key when creating a new volume. With customer-managed keys, you can fully manage the relationship between a key's life cycle, key usage permissions, and auditing operations on keys.

The following diagram demonstrates how customer-managed keys work with Azure NetApp Files:

:::image type="content" source="./media/configure-customer-managed-keys/customer-managed-keys-diagram.png" alt-text="Conceptual diagram of customer-managed keys." lightbox="./media/configure-customer-managed-keys/customer-managed-keys-diagram.png":::

  1. Azure NetApp Files grants permissions to encryption keys to a managed identity. The managed identity is either a user-assigned managed identity that you create and manage or a system-assigned managed identity associated with the NetApp account.

  2. You configure encryption with a customer-managed key for the NetApp account.

  3. You use the managed identity to which the Azure Key Vault admin granted permissions in step 1 to authenticate access to Azure Key Vault via Microsoft Entra ID.

  4. Azure NetApp Files wraps the account encryption key with the customer-managed key in Azure Key Vault.

    Customer-managed keys don't affect performance of Azure NetApp Files. Its only difference from platform-managed keys is how the key is managed.

  5. For read/write operations, Azure NetApp Files sends requests to Azure Key Vault to unwrap the account encryption key to perform encryption and decryption operations.

The cross-tenant customer-managed keys feature is available in all Azure NetApp Files supported regions.

Considerations

Important

To configure customer-managed keys for Elastic zone-redundant storage, see Configure customer managed keys for Elastic zone-redundant storage.

[!INCLUDE Customer-managed keys considerations]

Requirements

Before creating your first customer-managed key volume, you must set up:

  • An Azure Key Vault, containing at least one key.
    • The key vault must have soft delete and purge protection enabled.
    • The key must be of type RSA.
  • The key vault must have an Azure Private Endpoint.
    • The private endpoint must reside in a different subnet than the one delegated to Azure NetApp Files. The subnet must be in the same virtual network as the one delegated to Azure NetApp.

For more information about Azure Key Vault and Azure Private Endpoint, see:

Configure a NetApp account to use customer-managed keys

  1. In the Azure portal and under Azure NetApp Files, select Encryption.

    The Encryption page enables you to manage encryption settings for your NetApp account. It includes an option to let you set your NetApp account to use your own encryption key, which is stored in Azure Key Vault. This setting provides a system-assigned identity to the NetApp account, and it adds an access policy for the identity with the required key permissions.

    :::image type="content" source="./media/configure-customer-managed-keys/encryption-menu.png" alt-text="Screenshot of the encryption menu." lightbox="./media/configure-customer-managed-keys/encryption-menu.png":::

  2. When you set your NetApp account to use customer-managed key, you have two ways to specify the Key URI:

    • The Select from key vault option allows you to select a key vault and a key. :::image type="content" source="./media/configure-customer-managed-keys/select-key.png" alt-text="Screenshot of the select a key interface." lightbox="./media/configure-customer-managed-keys/select-key.png":::

    • The Enter key URI option allows you to enter manually the key URI. :::image type="content" source="./media/configure-customer-managed-keys/key-enter-uri.png" alt-text="Screenshot of the encryption menu showing key URI field." lightbox="./media/configure-customer-managed-keys/key-enter-uri.png":::

  3. Select the identity type that you want to use for authentication to the Azure Key Vault. If your Azure Key Vault is configured to use Vault access policy as its permission model, both options are available. Otherwise, only the user-assigned option is available.

    • If you choose System-assigned, select the Save button. The Azure portal configures the NetApp account automatically by adding a system-assigned identity to your NetApp account. An access policy is also created on your Azure Key Vault with key permissions Get, Encrypt, Decrypt.

    :::image type="content" source="./media/configure-customer-managed-keys/encryption-system-assigned.png" alt-text="Screenshot of the encryption menu with system-assigned options." lightbox="./media/configure-customer-managed-keys/encryption-system-assigned.png":::

    • If you choose User-assigned, you must select an identity. Choose Select an identity to open a context pane where you select a user-assigned managed identity.

    :::image type="content" source="./media/configure-customer-managed-keys/encryption-user-assigned.png" alt-text="Screenshot of user-assigned submenu." lightbox="./media/configure-customer-managed-keys/encryption-user-assigned.png":::

    If you've configured your Azure Key Vault to use Vault access policy, the Azure portal configures the NetApp account automatically with the following process: The user-assigned identity you select is added to your NetApp account. An access policy is created on your Azure Key Vault with the key permissions Get, Encrypt, Decrypt.

    If you've configure your Azure Key Vault to use Azure role-based access control, then you need to make sure the selected user-assigned identity has a role assignment on the key vault with permissions for actions:

  4. Select Save then observe the notification communicating the status of the operation. If the operation isn't successful, an error message displays. For assistance in resolving the error, see error messages and troubleshooting.

How you configure a NetApp account with customer-managed keys with the Azure CLI depends on whether you're using a system-assigned identity or an user-assigned identity.

Use a system-assigned identity

  1. Update your NetApp account to use a system-assigned identity.

    az netappfiles account update \
        --name <account_name> \
        --resource-group <resource_group> \
        --identity-type SystemAssigned
    
  2. To use an access policy, create a variable that includes the principal ID of the account identity, then run az keyvault set-policy and assign permissions of "Get," "Encrypt," and "Decrypt."

    netapp_account_principal=$(az netappfiles account show \
        --name <account_name> \
        --resource-group <resource_group> \
        --query identity.principalId \
        --output tsv)
    
    az keyvault set-policy \
        --name <key_vault_name> \
        --resource-group <resource-group> \
        --object-id $netapp_account_principal \
        --key-permissions get encrypt decrypt
    
  3. Update the NetApp account with your key vault.

    key_vault_uri=$(az keyvault show \
        --name <key-vault> \
        --resource-group <resource_group> \
        --query properties.vaultUri \
        --output tsv)
    az netappfiles account update --name <account_name> \  
        --resource-group <resource_group> \
        --key-source Microsoft.Keyvault \
        --key-vault-uri $key_vault_uri \
        --key-name <key>
    

Use a new user-assigned identity

  1. Create a new user-assigned identity.

    az identity create \
        --name <identity_name> \
        --resource-group <resource_group>
    
  2. Set an access policy for the key vault.

    user_assigned_identity_principal=$(az identity show \
        --name <identity_name> \
        --resource-group <resource_group> \
        --query properties.principalId \
        --output tsv)
    az keyvault set-policy \
        --name <key_vault_name> \
        --resource-group <resource-group> \
        --object-id $user_assigned_identity_principal \
        --key-permissions get encrypt decrypt
    

    [!NOTE] You can alternately use role-based access control to grant access to the key vault.

  3. Assign the user-assigned identity to the NetApp account and update the key vault encryption.

    key_vault_uri=$(az keyvault show \
        --name <key-vault> \
        --resource-group <resource_group> \
        --query properties.vaultUri \
        --output tsv)
    user_assigned_identity=$(az identity show \
        --name <identity_name> \
        --resource-group <resource_group> \
        --query id \
        --output tsv)
    az netappfiles account update --name <account_name> \  
        --resource-group <resource_group> \
        --identity-type UserAssigned \
        --key-source Microsoft.Keyvault \
        --key-vault-uri $key_vault_uri \
        --key-name <key> \
        --keyvault-resource-id <key-vault> \   
        --user-assigned-identity $user_assigned_identity
    

The process to configure a NetApp account with customer-managed keys in the Azure CLI depends on whether you're using a system-assigned identity or an user-assigned identity.

Enable access for system-assigned identity

  1. Update your NetApp account to use system-assigned identity.

    $netappAccount = Update-AzNetAppFilesAccount -ResourceGroupName <resource_group> -Name <account_name> -AssignIdentity
    
  2. To use an access policy, run Set-AzKeyVaultAccessPolicy with the key vault name, the principal ID of the account identity, and the permissions "Get," "Encrypt," and "Decrypt."

    Set-AzKeyVaultAccessPolicy -VaultName <key_vault_name> -ResourceGroupname <resource_group> -ObjectId $netappAccount.Identity.PrincipalId -PermissionsToKeys get,encrypt,decrypt
    
  3. Update your NetApp account with the key vault information.

    Update-AzNetAppFilesAccount -ResourceGroupName $netappAccount.ResourceGroupName -AccountName $netappAccount.Name -KeyVaultEncryption -KeyVaultUri <keyVaultUri> -KeyName <keyName>
    

Enable access for user-assigned identity

  1. Create a new user-assigned identity.

    $userId = New-AzUserAssignedIdentity -ResourceGroupName <resourceGroupName> -Name $userIdName
    
  2. Assign the access policy to the key vault.

    Set-AzKeyVaultAccessPolicy -VaultName <key_vault_name> `
        -ResourceGroupname <resource_group> `
        -ObjectId $userId.PrincipalId `
        -PermissionsToKeys get,encrypt,decrypt `
        -BypassObjectIdValidation
    

    [!NOTE] You can alternately use role-based access control to grant access to the key vault.

  3. Assign the user-assigned identity to the NetApp account and update the key vault encryption.

    $netappAccount = Update-AzNetAppFilesAccount -ResourceGroupName <resource_group> `
        -Name <account_name> `
        -IdentityType UserAssigned `
        -UserAssignedIdentityId $userId.Id `
        -KeyVaultEncryption `
        -KeyVaultUri <keyVaultUri> `
        -KeyName <keyName> `
        -EncryptionUserAssignedIdentity $userId.Id
    

Use role-based access control

You can use an Azure Key Vault that is configured to use Azure role-based access control. To configure customer-managed keys through Azure portal, you need to provide a user-assigned identity.

  1. In your Azure account, navigate to Key vaults then Access policies.

  2. To create an access policy, under Permission model, select Azure role-based access-control. :::image type="content" source="./media/configure-customer-managed-keys/rbac-permission.png" alt-text="Screenshot of access configuration menu." lightbox="./media/configure-customer-managed-keys/rbac-permission.png":::

  3. When creating the user-assigned role, there are three permissions required for customer-managed keys:

    1. Microsoft.KeyVault/vaults/keys/read
    2. Microsoft.KeyVault/vaults/keys/encrypt/action
    3. Microsoft.KeyVault/vaults/keys/decrypt/action

    Although there are predefined roles that include these permissions, those roles grant more privileges than are required. It's recommended that you create a custom role with only the minimum required permissions. For more information, see Azure custom roles.

    {
        "id": "/subscriptions/<subscription>/Microsoft.Authorization/roleDefinitions/<roleDefinitionsID>",
        "properties": {
            "roleName": "NetApp account",
            "description": "Has the necessary permissions for customer-managed key encryption: get key, encrypt and decrypt",
            "assignableScopes": [
                "/subscriptions/<subscriptionID>/resourceGroups/<resourceGroup>"
            ],
            "permissions": [
              {
                "actions": [],
                "notActions": [],
                "dataActions": [
                    "Microsoft.KeyVault/vaults/keys/read",
                    "Microsoft.KeyVault/vaults/keys/encrypt/action",
                    "Microsoft.KeyVault/vaults/keys/decrypt/action"
                ],
                "notDataActions": []
                }
            ]
          }
    }
  4. Once the custom role is created and available to use with the key vault, you apply it to the user-assigned identity.

:::image type="content" source="./media/configure-customer-managed-keys/rbac-review-assign.png" alt-text="Screenshot of role-based access control review and assign menu." lightbox="./media/configure-customer-managed-keys/rbac-review-assign.png":::

Create an Azure NetApp Files volume using customer-managed keys

  1. From Azure NetApp Files, select Volumes and then + Add volume.

  2. Follow the instructions in Configure network features for an Azure NetApp Files volume:

  3. For a NetApp account configured to use a customer-managed key, the Create Volume page includes an option Encryption Key Source.

    To encrypt the volume with your key, select Customer-Managed Key in the Encryption Key Source dropdown menu.

    When you create a volume using a customer-managed key, you must also select Standard for the Network features option. Basic network features are not supported.

    You must select a key vault private endpoint as well. The dropdown menu displays private endpoints in the selected virtual network. If there's no private endpoint for your key vault in the selected virtual network, then the dropdown is empty, and you won't be able to proceed. If you encounter this scenario, see Azure Private Endpoint.

    :::image type="content" source="./media/configure-customer-managed-keys/keys-create-volume.png" alt-text="Screenshot of create volume menu." lightbox="./media/configure-customer-managed-keys/keys-create-volume.png":::

  4. Continue to complete the volume creation process. Refer to:

Transition an Azure NetApp Files volume to customer-managed keys

Azure NetApp Files supports the ability to move existing volumes using platform-managed keys to customer-managed keys. Once you complete the migration, you can't revert to platform-managed keys.

Transition volumes

Note

When you transition volumes to use customer-managed keys, you must perform the transition for every virtual network where your Azure NetApp Files account has volumes. If you manage your Azure resources using Terraform, you should update all Terraform-managed Azure resources for all volumes that were modified out-of-band.

  1. Ensure you configured your Azure NetApp Files account to use customer-managed keys.
  2. In the Azure portal, navigate to Encryption.
  3. Select the CMK Migration tab.
  4. From the drop-down menu, select the virtual network and key vault private endpoint you want to use.
  5. Azure generates a list of volumes to be encrypted by your customer-managed key.
  6. Select Confirm to initiate the migration.

Rekey all volumes under a NetApp account

If you have already configured your NetApp account for customer-managed keys and have one or more volumes encrypted with customer-managed keys, you can change the key that is used to encrypt all volumes under the NetApp account. You can select any key that is in the same key vault. Changing key vaults isn't supported.

  1. Under your NetApp account, navigate to the Encryption menu. Under the Current key input field, select the Rekey link. :::image type="content" source="./media/configure-customer-managed-keys/encryption-current-key.png" alt-text="Screenshot of the encryption key." lightbox="./media/configure-customer-managed-keys/encryption-current-key.png":::

  2. In the Rekey menu, select one of the available keys from the dropdown menu. The chosen key must be different from the current key. :::image type="content" source="./media/configure-customer-managed-keys/encryption-rekey.png" alt-text="Screenshot of the rekey menu." lightbox="./media/configure-customer-managed-keys/encryption-rekey.png":::

  3. Select OK to save. The rekey operation can take several minutes.

Switch from system-assigned to user-assigned identity

To switch from system-assigned to user-assigned identity, you must grant the target identity access to the key vault being used with read/get, encrypt, and decrypt permissions.

  1. Update the NetApp account by sending a PATCH request using the az rest command:

    az rest -m PATCH -u <netapp-account-resource-id>?api-versions=2022-09-01 -b @path/to/payload.json
    

    The payload should use the following structure:

    {
      "identity": {
        "type": "UserAssigned",
        "userAssignedIdentities": {
         "<identity-resource-id>": {}
        }
      },
      "properties": {
        "encryption": {
          "identity": {
            "userAssignedIdentity": "<identity-resource-id>"
          }
        }
      }
    }
  2. Confirm the operation completed successfully with the az netappfiles account show command. The output includes the following fields:

        "id": "/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.NetApp/netAppAccounts/account",
        "identity": {
            "principalId": null,
            "tenantId": null,
            "type": "UserAssigned",
            "userAssignedIdentities": {
                "/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<identity>": {
                    "clientId": "<client-id>",
                    "principalId": "<principalId>",
                    "tenantId": <tenantId>"
                }
            }
        },
    

    Ensure that:

    • encryption.identity.principalId matches the value in identity.userAssignedIdentities.principalId
    • encryption.identity.userAssignedIdentity matches the value in identity.userAssignedIdentities[]
    "encryption": {
        "identity": {
            "principalId": "<principal-id>",
            "userAssignedIdentity": "/subscriptions/<subscriptionId>/resourceGroups/<resource-group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<identity>"
        },
        "KeySource": "Microsoft.KeyVault",
    },

Update the private endpoint

Making changes to the Azure Private Endpoint after creating a customer-managed key volume can make the volume inaccessible. If you need to make changes, you must create a new endpoint and update the volume to point to the new endpoint.

  1. Create a new endpoint between the virtual network and Azure Key Vault.
  2. Update all volumes using the old endpoint to use the new endpoint.
    az netappfiles volume update --g $resource-group-name --account-name $netapp-account-name --pool-name $pool-name --name $volume-name --key-vault-private-endpoint-resource-id $newendpoint
    
  3. Delete the old private endpoint.

Next steps