Symptoms
- ADF Databricks activities fail with
401/403orInvalid access token. - CI/CD (
databricks bundle deploy, Terraform) fails with authentication errors. AADSTS7000222(Entra secret expired) orinvalid_clienterrors.
1. Which credential?
| Caller authenticates with | Expires | Rotate in |
|---|---|---|
| Entra ID client secret → Entra token | App registration secret end date | Entra ID |
| Databricks OAuth secret (M2M) for a service principal | Secret lifetime set at creation | Databricks account/workspace |
| Personal access token (PAT) | Token lifetime / max lifetime policy | Workspace user settings or admin token management |
| ADF managed identity | Doesn't expire | Check permissions instead |
# PATs in the workspace (admin view)
databricks token-management list --output json | jq -r '.[] | [.token_id, .created_by_username, .comment, (.expiry_time/1000|todate)] | @tsv'
2. Rotate
Entra client secret:
az ad app credential reset --id <appId> --append --display-name "dbx-2026-10" --years 1 --query password -o tsv
Databricks OAuth secret for a service principal (account console → Service principals → Secrets → Generate secret, or the account API). Keep the old secret until consumers are updated, then delete it.
PAT (for a service principal, created on its behalf by an admin):
databricks token-management create-obo-token <sp-application-id> --lifetime-seconds 7776000 --comment "adf-prod-2026-10"
Put new values straight into Key Vault:
az keyvault secret set --vault-name kv-data --name dbx-sp-secret --value "<value>"
3. Update consumers
| Consumer | Where |
|---|---|
| ADF linked service | Key Vault reference (preferred) or the linked service auth settings; re-publish |
| GitHub Actions / Azure DevOps | Pipeline secrets / variable groups |
| Terraform | ARM_CLIENT_SECRET or DATABRICKS_CLIENT_SECRET |
| Power BI / external BI tools | Data source credentials |
Run one pipeline end to end before declaring recovery, then rerun failed ADF runs from the failed activity.
4. Move to credentials that don't expire
- ADF → Databricks: use the factory's managed identity in the Databricks linked service. Add the managed identity to the workspace (as a service principal) with permissions on the clusters/jobs it runs.
- GitHub Actions / Azure DevOps → Databricks: workload identity federation (OIDC) with an Entra service principal, or Databricks OAuth token federation where supported — no stored secret.
- People: OAuth U2M (
databricks auth login) instead of PATs.
Then restrict PATs: workspace admin settings → set a maximum token lifetime, or disable PATs for users who don't need them.
Prevent it next time
- Alert 30 days before any secret used by production expires (Entra app credentials, Databricks OAuth secrets, PATs).
- One credential per consumer, so rotation affects one thing at a time.
- All secrets in Key Vault, never in pipeline YAML or notebooks.