Home / Databricks on Azure

Databricks on AzureRunbookAdvanced

Sev1: Databricks personal access token leaked — revoke, audit access, lock down tokens

Respond to a Databricks PAT found in Git, a notebook output or a log. Revoke the token, find what it was used for in audit system tables, check data access and exfiltration paths, and move people and automation to OAuth.

Deepak Bhardwaj2 min read

Applies toAzure Databricks workspaces with Unity Catalog, system.access.audit, token management APIs, Databricks CLI

1. Revoke now

As a workspace admin:

databricks token-management list --output json | \
  jq -r '.[] | [.token_id, .created_by_username, .comment, (.creation_time/1000|todate), (.expiry_time/1000|todate)] | @tsv'
databricks token-management delete <token-id>

If you can't match the leaked value to an ID (you can't see token values, only metadata), revoke all tokens of the owning user, or temporarily deactivate the user/service principal.

2. What did the token do?

SELECT event_time, source_ip_address, user_agent, service_name, action_name,
       request_params, response.status_code
FROM system.access.audit
WHERE user_identity.email = 'owner@contoso.com'
  AND event_date >= current_date() - 30
  AND (user_agent NOT LIKE '%Browser%')
ORDER BY event_time DESC;

Look for:

Action Concern
getTable, generateTemporaryTableCredential, SQL statements Data read
createToken, addPrincipalToGroup, permission changes Persistence / privilege escalation
runCommand / submitRun from unknown IPs Code executed on your clusters
downloadQueryResult, exports, dbfs / filesystem reads Data exfiltration
Secret reads (getSecret) Further credential exposure

Filter by source_ip_address outside your corporate ranges to see attacker activity.

3. Contain further

  • If secrets were read, rotate them (storage keys, database passwords, API keys) — the secret scope values are exposed.
  • If the token's owner was an admin, review admin changes: new users, groups, tokens, IP access lists, cluster policies.
  • Check for new jobs or init scripts that could persist access.

4. Data impact

Use Unity Catalog lineage and audit to list tables accessed in the window. Involve your security, privacy and legal teams if sensitive data was read.

5. Lock tokens down

  • IP access lists so tokens only work from corporate networks:
databricks ip-access-lists create --label corp --list-type ALLOW --ip-addresses 203.0.113.0/24

(Enable the IP access list feature in workspace settings first.)

  • Token lifetime limit and restricted token permissions (only specific groups may create PATs).
  • People: OAuth U2M via the CLI (databricks auth login) and SSO; no PATs.
  • Automation: service principals with OAuth M2M or Entra workload identity federation.
  • Secret scanning on repos; strip notebook outputs before committing.

Warning

Notebook outputs often contain tokens and connection strings printed during debugging. Treat exported notebooks (.ipynb/.dbc) as sensitive.

Prevent it next time

  • Disable PATs for users where your tools allow it; enforce max lifetime elsewhere.
  • Alert on token creation and on API calls from outside allowed IPs (audit table queries scheduled as alerts).