Configure customer-managed keys

Azure Data Explorer encrypts all data in a storage account at rest. By default, data is encrypted with Microsoft-managed keys. For extra control over encryption keys, you can supply customer-managed keys to use for data encryption.

Customer-managed keys must be stored in an Azure Key Vault. You can create your own keys and store them in a key vault, or you can use an Azure Key Vault API to generate keys. The Azure Data Explorer cluster and the key vault must be in the same region, but they can be in different subscriptions. For a detailed explanation on customer-managed keys, see customer-managed keys with Azure Key Vault.

This article shows you how to configure customer-managed keys.

For code samples based on previous SDK versions, see the archived article.

Configure Azure Key Vault

To configure customer-managed keys with Azure Data Explorer, you must set two properties on the key vault: Soft Delete and Do Not Purge. These properties aren't enabled by default. To enable these properties, perform Enabling soft-delete and Enabling Purge Protection in PowerShell or Azure CLI on a new or existing key vault. Only RSA keys of size 2048 are supported. For more information about keys, see Key Vault keys.

Note

For information about the limitations of using customer managed keys on leader and follower clusters, see Limitations.

Assign a managed identity to the cluster

To enable customer-managed keys for your cluster, first assign either a system-assigned or user-assigned managed identity to the cluster. You'll use this managed identity to grant the cluster permissions to access the key vault. To configure managed identities, see managed identities.

Enable encryption with customer-managed keys

The following steps explain how to enable customer-managed keys encryption using the Azure portal. By default, Azure Data Explorer encryption uses Microsoft-managed keys. Configure your Azure Data Explorer cluster to use customer-managed keys and specify the key to associate with the cluster.

  1. In the Azure portal, go to your Azure Data Explorer cluster resource.

  2. Select Settings > Encryption in left pane of portal.

  3. In the Encryption pane, select On for the Customer-managed key setting.

  4. Select Select Key.

    Screenshot showing configure customer-managed keys.

  5. In the Select key from Azure Key Vault window, select an existing Key vault from the dropdown list. If you select Create new to create a new Key Vault, you'll be routed to the Create Key Vault screen.

  6. Select Key.

  7. Version:

    • To ensure that this key always uses the latest key version, select the Always use current key version checkbox.
    • Otherwise, select Version.
  8. Select Select.

    Screenshot showing the Select key from Azure Key Vault.

  9. Under Identity type, select System Assigned or User Assigned.

  10. If you select User Assigned, pick a user assigned identity from the dropdown.

    Screenshot showing the option to select a managed identity type.

  11. In the Encryption pane that now contains your key, select Save. When CMK creation succeeds, you'll see a success message in Notifications.

    Screenshot showing option to save a customer-managed key.

If you select system assigned identity when enabling customer-managed keys for your Azure Data Explorer cluster, you'll create a system assigned identity for the cluster if one doesn't exist. In addition, you'll be providing the required get, wrapKey, and unwrapKey permissions to your Azure Data Explorer cluster on the selected Key Vault and get the Key Vault properties.

Note

Select Off to remove the customer-managed key after it has been created.

Update the key version

When you create a new version of a key, you'll need to update the cluster to use the new version. First, call Get-AzKeyVaultKey to get the latest version of the key. Then update the cluster's key vault properties to use the new version of the key, as shown in Enable encryption with customer-managed keys.