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 Azure CLI client. 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. Run the following command to sign in to Azure:

    az login
    
  2. Set the subscription where your cluster is registered. Replace MyAzureSub with the name of the Azure subscription that you want to use.

    az account set --subscription MyAzureSub
    
  3. Run the following command to set the new key with the cluster's system assigned identity

    az kusto cluster update --cluster-name "mytestcluster" --resource-group "mytestrg" --key-vault-properties key-name="<key-name>" key-version="<key-version>" key-vault-uri="<key-vault-uri>"
    

    Alternatively, set the new key with a user assigned identity.

    az kusto cluster update --cluster-name "mytestcluster" --resource-group "mytestrg" --key-vault-properties key-name="<key-name>" key-version="<key-version>" key-vault-uri="<key-vault-uri>" key-user-identity="<user-identity-resource-id>"
    
  4. Run the following command and check the 'keyVaultProperties' property to verify the cluster updated successfully.

    az kusto cluster show --cluster-name "mytestcluster" --resource-group "mytestrg"
    

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.