Home / Databricks on Azure

Databricks on AzureRunbookAdvanced

Sev1: Azure Databricks clusters won't start and notebooks fail after a customer-managed key was disabled or lost

Clusters fail with KeyVaultAccessForbidden, notebooks or DBFS root stop working, or catalogs return decryption errors after a Key Vault change. Find which key broke, re-enable or recover it, and restore access.

Deepak Bhardwaj7 min read

Applies toAzure Databricks Premium workspaces with customer-managed keys for managed services, managed disks, DBFS root or Unity Catalog; Azure Key Vault and Managed HSM

Symptoms

A Key Vault change (key disabled, expired, deleted, access policy or RBAC removed, vault firewall tightened) breaks a workspace that uses customer-managed keys (CMK). What fails depends on which CMK the key protects:

CMK scope What users see
Managed disks New clusters fail to start, often with KeyVaultAccessForbidden. Running clusters may keep going until they restart or scale.
Managed services (control plane) Notebooks, secrets and query text can't be read or saved. Failure starts after a cache interval, not instantly.
DBFS root Reads and writes to dbfs:/ paths, the workspace storage account, init scripts or libraries stored there fail.
Unity Catalog (catalog-level CMK, where enabled) Queries on catalogs using that key fail with a decryption error.

Other parts of the workspace often keep working, so the incident looks partial: "SQL works but jobs can't start" or "jobs run but nobody can open a notebook".

Caution

Do not purge a deleted key or vault, and do not create a "replacement" key with the same name hoping it will work. Data encrypted with the old key can only be decrypted with that key. Purging it can make DBFS root and control-plane data permanently unreadable.

1. Confirm scope and impact (5 minutes)

List which encryption features the workspace uses and which key each points to:

az databricks workspace show -g rg-dbx-prod -n dbx-prod -o json > ws.json
# Look for the "encryption" sections (managedServices, managedDisk) and the DBFS "parameters.encryption" block.
# Property paths vary by CLI/extension version; search the JSON for "keyVaultUri" and "keyName".
grep -n -i -E 'keyvault|keyname|keyversion' ws.json

Write down, for each scope: vault URI, key name, key version (or "latest" if auto-rotation is used).

Then pick one failing cluster and read the termination reason in Compute > cluster > Event log. KeyVaultAccessForbidden or a disk encryption set error points to the managed disks key.

2. Check the key itself

VAULT=kv-dbx-cmk
KEY=dbx-cmk

az keyvault key show --vault-name $VAULT --name $KEY \
  --query "{enabled:attributes.enabled, expires:attributes.expires, kid:key.kid}" -o table

az keyvault key list-versions --vault-name $VAULT --name $KEY \
  --query "[].{kid:kid, enabled:attributes.enabled, expires:attributes.expires}" -o table
Finding Go to
Key or the pinned version is disabled Step 3a
Key expired (expires in the past) Step 3a
Key not found Step 3b
Vault not found Step 3b
Key fine Step 4 (access) and step 5 (network)

3a. Re-enable or extend the key

# Re-enable the exact version the workspace uses
az keyvault key set-attributes --vault-name $VAULT --name $KEY --version <version> --enabled true

# Push out an expiry date that was hit
az keyvault key set-attributes --vault-name $VAULT --name $KEY --version <version> --expires 2027-12-31T00:00:00Z

If a newer version was created by rotation and an older one disabled, keep the version the workspace references enabled. Do not disable old versions until you have confirmed nothing still uses them.

3b. Recover a deleted key or vault

Soft delete is on by default for Key Vault. Recover, don't recreate:

az keyvault list-deleted --query "[].{name:name, deleted:properties.deletionDate, purge:properties.scheduledPurgeDate}" -o table
az keyvault recover --name $VAULT

az keyvault key list-deleted --vault-name $VAULT -o table
az keyvault key recover --vault-name $VAULT --name $KEY

The recovered key keeps its versions and ID, so the workspace configuration does not need to change. If the key was purged and no backup exists (az keyvault key backup), open a Sev A ticket with Microsoft immediately and expect data protected only by that key to be lost.

4. Restore access to the key

Each scope uses a different identity to reach the key:

Scope Identity that needs the key
Managed disks The disk encryption set in the workspace's managed resource group
DBFS root The managed identity of the workspace storage account
Managed services The Azure Databricks first-party application in your tenant

Required key permissions are get, wrapKey and unwrapKey.

Find the disk encryption set and its identity:

MRG=$(az databricks workspace show -g rg-dbx-prod -n dbx-prod --query managedResourceGroupId -o tsv | awk -F/ '{print $NF}')
az disk-encryption-set list -g $MRG --query "[].{name:name, principal:identity.principalId}" -o table

Vault using access policies:

az keyvault set-policy --name $VAULT --object-id <principal-id> --key-permissions get wrapKey unwrapKey

Vault using Azure RBAC:

KV_ID=$(az keyvault show --name $VAULT --query id -o tsv)
az role assignment create --assignee-object-id <principal-id> --assignee-principal-type ServicePrincipal \
  --role "Key Vault Crypto Service Encryption User" --scope $KV_ID/keys/$KEY

If someone switched the vault from access policies to RBAC (or back), the old grants no longer apply. That one change can break every scope at once. Check:

az keyvault show --name $VAULT --query "properties.{rbac:enableRbacAuthorization, softDelete:enableSoftDelete, purgeProtection:enablePurgeProtection}"

5. Check the Key Vault firewall

az keyvault show --name $VAULT --query "properties.networkAcls"

If defaultAction is Deny, trusted Microsoft services must be allowed to bypass it, or you need a private endpoint path the services can use:

az keyvault update --name $VAULT --bypass AzureServices

6. Find what changed

Control-plane changes (policies, RBAC, firewall, vault deletes) are in the Activity Log:

az monitor activity-log list --resource-group rg-security --offset 2d \
  --query "[?contains(operationName.value, 'Microsoft.KeyVault') || contains(operationName.value, 'roleAssignments')].{t:eventTimestamp, op:operationName.value, who:caller}" -o table

Key disables and deletes are data-plane operations. They only appear if the vault sends diagnostic logs to Log Analytics:

AzureDiagnostics
| where ResourceProvider == "MICROSOFT.KEYVAULT" and TimeGenerated > ago(2d)
| where OperationName has "Key" or OperationName has "Policy"
| project TimeGenerated, OperationName, Resource, identity_claim_upn_s, CallerIPAddress, ResultType
| order by TimeGenerated desc

Column names depend on whether you use AzureDiagnostics or the resource-specific tables. Check your workspace schema.

7. Verify recovery

  • Start a test cluster. It reaches Running without key errors.
  • Open and save a notebook. Read a secret: dbutils.secrets.get("scope", "key").
  • If DBFS root CMK is used: dbutils.fs.ls("dbfs:/").
  • Repair failed job runs (Jobs > run > Repair run) and restart streaming jobs that stopped on the errors.
  • Managed services failures can take a few minutes to clear after access returns, because of key caching.

Communicate

"Databricks cluster starts [and notebook access] failed from HH:MM because the encryption key in Key Vault was [disabled / deleted / access removed]. Access is restored as of HH:MM. Failed job runs are being repaired. No data was lost." Only say "no data was lost" if the key was never purged.

Prevent it next time

  • Turn on purge protection on every vault that holds Databricks CMKs.
  • Put a CanNotDelete lock on the vault and keep its keys in a dedicated vault with a small set of owners.
  • Use key auto-rotation instead of manual disabling of old versions, and review expiry dates ahead of time.
  • Send Key Vault diagnostic logs to Log Analytics and alert on KeyUpdate, KeyDelete, policy changes and RBAC changes for this vault.
  • Keep a az keyvault key backup copy of each CMK in a separate, locked-down location.
  • Document which identity needs the key for each scope (table in step 4) in the workspace runbook.