Databricks Field Guide

Operating · Chapter 24

Databricks security: identity, network, keys and audit logs

Reviewed by TechFabric engineers. How we write this guide →

Databricks security comes down to one question asked of every path into the data: which identity does the request carry when it arrives? Unity Catalog grants, row filters and column masks are evaluated against that identity, so the controls are only as good as the choice of person, service principal or Postgres role on each path. Around that sit the network paths (Private Link for classic compute, network policies for serverless), customer-managed keys, and the audit log in system.access.audit.

The usual failure is a correct rule evaluated against the wrong identity, and it raises no alarm. Andrey Taran's team saw the other direction on an embedded reporting build, where a pipe in the tenant key blanked every customer's dashboard at once; Multi-tenant reporting has that story. This chapter takes the identity question one path at a time, then covers the network, keys, secrets and audit trail, as documented in October 2026. Catalogs, grants and lineage have their own chapter, Unity Catalog.

The short version

Every way into the data carries someone's identity. It might be a person at a SQL editor, a scheduled job, an app or an AI agent, a customer looking at an embedded dashboard, or an application writing to a database. The permissions only protect anything if the identity reaching the data is the right one. The usual failure is a rule evaluating correctly against the wrong identity, often a shared account with broad access, so the wrong person gets an answer and nothing raises an alarm. Most of the security work on Databricks is deciding which identity each path uses, then testing that it behaves the way you think. The network, encryption keys and audit logs matter too, and they're mostly configuration you set once and review.

Which identity reaches the data on each path? #

user authorization

app authorization

tenant id in embed token

one-hour OAuth token

Corporate identity provider

Person

App or agent

Service principal
OAuth M2M

Scheduled job

Unity Catalog
grants, row filters, masks

Embedded viewer
no Databricks login

Dashboard SQL
joins on the tenant id

Application on Lakebase

Postgres role
GRANT and row-level security

Four of the five paths reach the data as a person, a service principal or a Postgres role, and an embedded viewer reaches it only through a tenant id

There are five paths in, and only some of them end where you'd expect. A person comes from the corporate identity provider. A scheduled job runs as a service principal using OAuth machine-to-machine credentials. An app or an agent is either the person using it (user authorization) or its own service principal (app authorization), and those two meet Unity Catalog's grants, row filters and masks. An embedded viewer has no Databricks identity at all, so the dashboard SQL joins on the tenant id from the embed token. And an application on Lakebase connects as a Postgres role, minted from a one-hour OAuth token, where ordinary GRANT and row-level security decide what it reads.

People #

Users and groups should come from the corporate identity provider and never be created by hand in a workspace. Automatic identity management brings them across from Microsoft Entra ID without a SCIM application to maintain, nested groups and service principals included. Okta support is in Public Preview and doesn't sync nested groups. Where SCIM is already running it keeps managing the identities it created, so the two can coexist during a move.

We'd define groups once at the account and assign them into workspaces. The reason we'd insist on automated provisioning is offboarding. A hand-managed membership survives the person's last day, and that gap is exactly what an access review exists to find.

Jobs #

A pipeline that authenticates as the engineer who wrote it breaks when that engineer changes role, and until then it can do anything that person can do. We'd run every scheduled job as a service principal with OAuth machine-to-machine credentials. Databricks now describes personal access tokens as a legacy authentication method, and we'd drive them toward zero. Cap the lifetime of new tokens (the default maximum is 730 days), restrict who may create them, and turn token authentication off in the workspace once nothing depends on it. Both the cap and the review are a CLI call (token management):

# New tokens in this workspace expire within 90 days
databricks workspace-conf set-status --json '{"maxTokenLifetimeDays": "90"}'

# Every token in the workspace, with owner and expiry, for the quarterly review
databricks token-management list --output json
databricks token-management delete <token-id>

The audit log section below has the query that shows who created tokens and when.

Apps and agents #

This is the path we'd look at first on an estate we inherit, because a correct policy can return the wrong answer here without anyone noticing. A Databricks app gets its own service principal by default, and every user of the app shares that principal's access. With user authorization the app acts as the person instead. Databricks forwards the user's token to the app in the x-forwarded-access-token header, the app passes it to the SQL connector, and the user's own Unity Catalog permissions apply, row filters and column masks included (app authorization). The app also declares scopes such as sql or genie, and Databricks blocks anything outside them even if the user could do it.

Sushruth Aeluguri, a Databricks engineer at TechFabric, worked through what goes wrong on a healthcare design. An agent running as a broadly granted service principal hands a coordinator records the row filter would have hidden from them. The filter and the SSN mask both behaved correctly, because they evaluated against the service principal. His test for it is to call the same tool twice for the same record, once on behalf of a user and once as the service principal, and compare. The service principal call succeeds with no error and no empty result, which is why nothing alerts.

We'd run interactive apps and agents on behalf of the user by default, so the audit trail names a person and there's no second access model to keep in step. A batch agent with no user behind it runs as a service principal with the narrowest grant that does the job, ideally EXECUTE on the same Unity Catalog functions a person would call (how we'd govern agents). Agents on Databricks has the rest of that design.

Viewers with no Databricks login #

When the readers are your customers, they have no Databricks identity for a row filter to evaluate, so the isolation moves into the dashboard SQL: the tenant id travels in the embed token and every dataset joins on it. It's only as good as that join. We'd restrict the tenant key to letters, digits and one agreed separator from the first day, and load every dashboard with a real token on each deploy. Multi-tenant reporting covers the design and the ways the join quietly returns zero rows.

Applications on Lakebase #

An application on Lakebase connects as a Postgres role, and with enable_pg_native_login set to false there is no database password at all: a person at psql and an application holding client credentials both arrive with a one-hour OAuth token. The Data API runs each request as the caller's identity, so GRANT and Postgres row-level security are the whole authorization model. At the first Gilbert Databricks User Group session, one row-level security policy gave three different answers to the owner, a service principal and an insert it refused, which is the same habit as Sushruth's two-identity test on a different engine.

How do ABAC row filters and column masks work? #

Once the identity is right, row filters and column masks are how one table serves people with different entitlements. Users query the real table and get the rows and columns they're allowed, so there's no family of restricted views to keep in step, and a view only protects the people who query the view.

We'd drive them from governed tags instead of writing a mask per table. With attribute-based access control, one policy on a schema, catalog or metastore applies to every table carrying the tag, including tables created next year (ABAC policies). This is the documentation's own example, where ssn_to_last_nr and non_eu_region are functions you define first:

governance/policies/mask_ssn.sqlsql
CREATE POLICY mask_ssn ON SCHEMA prod.customers
  COLUMN MASK ssn_to_last_nr TO us_analysts EXCEPT admins FOR TABLES
  MATCH COLUMNS has_tag_value('pii', 'ssn') AS ssn ON COLUMN ssn USING COLUMNS (4);

CREATE POLICY hide_eu_customers ON SCHEMA prod.customers
  ROW FILTER non_eu_region TO us_analysts FOR TABLES WHEN has_tag_value('sensitivity', 'high')
  MATCH COLUMNS has_tag('geo_region') AS region USING COLUMNS (region);

Reading an ABAC-secured table needs serverless compute, standard compute on Databricks Runtime 16.4 or above, or dedicated compute on 16.4 or above with fine-grained access control filtering enabled (compute requirements); older runtimes can't read it at all. DENY policies and metastore-level policies are still Beta, and policies on views are Beta and need Runtime 19 or above, per the ABAC overview as of 22 October 2026. The design work we'd spend time on is the tag vocabulary rather than the SQL. Who may apply pii, who may remove it, and what happens to a column nobody tagged?

Sushruth's write-up is also specific about cost, which is where we'd expect pushback from a BI team. Filter and mask functions run per row as part of the query plan. A simple expression over a column plus is_account_group_member is cheap, while a filter that joins a consent table or calls a Python UDF becomes a lookup on every scan by every user. His fix is to compute the decision into a column in the pipeline and let the filter read that column. Only one distinct row filter per table and one mask per column can resolve for a given user, and a conflict throws an error, so two teams' overlapping policies fail loudly the first time someone in both groups runs a query.

Network paths for classic and serverless compute #

For classic compute the product is AWS PrivateLink, Azure Private Link or Google Cloud's Private Service Connect, and it's bought in two halves that get approved separately. The front-end connection covers users reaching the workspace and its REST API. The back-end connection covers clusters in your network reaching the control plane, and on AWS it needs two endpoints, one for the workspace and one for the secure cluster connectivity relay, which catches teams who budgeted for one. We'd get the back-end half approved first, because it's the one that keeps cluster traffic off the public internet, and add the front-end half when the workspace's users all sit on the corporate network.

Serverless is a different question, because there's no cluster in your network to attach rules to. Two account-level objects replace the firewall. A network connectivity configuration (NCC) is a regional object holding private endpoint rules, so serverless compute reaches your storage or databases privately. A network policy is serverless egress control, created in the account console under Security, Networking, and attached to workspaces (one policy per workspace, Enterprise tier). In restricted mode it allows only listed domains and storage destinations, up to 100 of each per policy, and its dry-run mode logs what would have been blocked without blocking it. We'd run dry-run for two weeks and read the denials before enforcing, because the first enforced day otherwise finds every package index and webhook nobody listed.

On Azure there is one more route. Andrey set out the routing on Azure. Every outbound serverless connection is matched against four paths in a fixed order, and the first match wins:

  1. a private endpoint rule in the network connectivity configuration;
  2. an Azure service endpoint;
  3. the private network gateway, for a listed destination or for all traffic;
  4. default serverless egress.

Two consequences sit in the setup guide's troubleshooting table rather than the overview. Blob storage always takes the service endpoint path and the gateway can't override it, so if auditors expect every byte of egress to cross your firewall, storage traffic won't. And a gateway destination whose DNS name matches an Azure service endpoint suffix, such as an Azure SQL Database or a Key Vault, takes the service endpoint path too, which a more specific DNS name on the gateway fixes for a private-only resource. A serverless egress control policy is also evaluated before the gateway, so when a configured destination is still dropped, the egress policy is the first place we'd look.

The gateway is in Public Preview on Azure, with billing from on or after 1 December 2026. We'd pilot it on one source with the existing Private Link path left in place.

Restricting egress from classic compute has the most operational friction, because it breaks package installs from public repositories. We'd stand up an internal package mirror before switching the restriction on, so nobody needs a permanent exception for PyPI.

Customer-managed keys and what they cover #

Databricks encrypts data at rest whether or not you bring a key. Regulated customers ask for customer-managed keys because key custody is a control they can show an auditor. The key sits in their own key service and its use is logged there. Withdrawing it withdraws access. There are two configurations, and they cover different data (customer-managed keys).

Key What it encrypts
Managed services Control plane data: notebook source and results, secrets, Git credentials, SQL queries and query history, AI/BI dashboards created after 1 November 2024, Genie Agents, AI Search indexes and metadata, Lakebase Autoscaling project data
Workspace storage Your workspace storage bucket: the DBFS root, job results, SQL results and notebook revisions, and optionally the volumes attached to classic compute

A classic workspace can take both keys. A serverless workspace needs only the managed services key, which also covers its workspace storage.

The trap is the data that isn't in either row. Ihor Seleznov wrote up customer-held keys for an application database on Azure, and his warning carries straight over to Databricks. A customer who revokes a key expecting their data to go dark everywhere will find it still readable in every copy the key doesn't protect. On a Databricks estate that means the tables in your own cloud storage, a search index, a cache, an export in a bucket. We'd map every store that holds the customer's data before promising anything, write down which ones their key protects, and rehearse a revocation on a sandbox workspace before telling anyone what it does in production.

When do you need the compliance security profile? #

The compliance security profile is a workspace setting for regulated data. It turns on a CIS Level 1 hardened compute image with FIPS 140 validated encryption modules, automatic cluster update, antivirus and file-integrity monitoring on compute, enforced Nitro instances on AWS and TLS 1.2 or above for egress. It's the prerequisite for processing data under HIPAA, PCI-DSS, FedRAMP Moderate and High, HITRUST, IRAP, C5, TISAX and several others, and which serverless features are covered varies by standard and region, so check the standard's table before promising a serverless design. Databricks calls enabling it a permanent change: support can turn it off only if the workspace never processed regulated data, otherwise the workspace has to be deleted. We'd enable it on a dedicated regulated workspace rather than on a shared one.

Secrets #

Secrets belong in a secret scope, referenced by name at runtime, and never in notebook source, job parameters, cluster environment variables or a file in the repository. On Azure a scope can be backed by Azure Key Vault; on AWS and Google Cloud scopes are Databricks-backed (secrets). Where an integration supports workload identity federation we'd use it instead, because a credential that's never issued never needs rotating.

How do you query Databricks audit logs? #

Audit logs cover authentication, data access and administrative change, and they're only useful if they also leave the platform for somewhere with its own retention and its own access. Configure delivery on day one, because audit logs switched on after an incident don't cover the incident. The same events are queryable in system.access.audit (Public Preview, 365 days of retention), so "who read this table last month" is a SQL query. Unity Catalog logs generateTemporaryTableCredential whenever it hands out a credential to read a table, which Databricks' audit log reference names as the event for who queried what and when:

-- Who read a table in the last 30 days, and from where
SELECT event_time,
       user_identity.email,
       request_params['operation']       AS operation,
       source_ip_address,
       workspace_id
FROM system.access.audit
WHERE service_name = 'unityCatalog'
  AND action_name  = 'generateTemporaryTableCredential'
  AND request_params['table_full_name'] = 'prod.customers.accounts'
  AND event_date >= current_date() - INTERVAL 30 DAYS
ORDER BY event_time DESC;

Token creation is the detection rule we'd write first, because a personal access token is a credential that outlives the session that made it. It's generateDbToken under the accounts service, and revocation is revokeDbToken:

-- Personal access tokens created in the last 7 days, newest first
SELECT event_time,
       user_identity.email                    AS created_by,
       request_params['tokenExpirationTime']  AS expires,
       source_ip_address,
       user_agent,
       response.status_code
FROM system.access.audit
WHERE service_name = 'accounts'
  AND action_name  = 'generateDbToken'
  AND event_date >= current_date() - INTERVAL 7 DAYS
ORDER BY event_time DESC;

Scheduled as a SQL alert that fires on any row, the second query is the detection; a red-team exercise that creates a token should trip it within the delivery delay, which Databricks puts at typically 15 minutes for audit events.

Quarterly access reviews #

We'd run two access reviews a quarter and expect them to find more than any tooling. The first lists every group, its members and its grants, and goes to the data owner rather than the platform team, because only the owner knows that someone no longer needs access. The second lists direct grants, service principals and exceptions, and the goal is an empty direct-grant list. It won't be empty the first time. This query starts the second review, against a table of approved groups you keep yourself:

reviews/direct_grants.sqlsql
SELECT grantee, table_catalog, table_schema, table_name, privilege_type
FROM system.information_schema.table_privileges
WHERE grantee NOT IN (SELECT group_name FROM governance.approved_groups)
ORDER BY table_catalog, table_schema, table_name;

The information schema doesn't contain metadata about hive_metastore objects. On an estate still carrying legacy tables, this query will never show the grants on them, so we'd audit those from the legacy catalog directly until they're migrated.

Test one policy against every identity first #

On a new account, or one we're inheriting, we'd pick the most sensitive table that has a row filter or mask and list every path that reaches it. That's the people who query it, the jobs, the apps and agents, any embedded dashboard and any application. Then we'd query it as each of those identities and compare what comes back with what that identity should see. Any identity that gets more than it should is the first fix, before the token settings, the network paths or the keys.

Questions people ask #

What does Unity Catalog do for Databricks security? #

It's the one place that decides who can read which tables, rows and columns, for SQL, notebooks, jobs, apps and agents alike. It holds the cloud storage credentials itself and vends short-lived ones per query, so people don't need direct access to the buckets. It doesn't decide which identity a request arrives with, so that still has to be designed path by path.

Should a Databricks app or agent run as the user or as a service principal? #

We'd run anything interactive as the user, with user authorization, so row filters and masks apply to the person asking and the audit log names them. A job with no user behind it, such as an overnight batch agent, runs as a service principal with the narrowest grant that works. The risk is an interactive app on a broadly granted service principal, which returns restricted rows with no error at all.

Can Unity Catalog row filters protect embedded dashboards for external customers? #

Not on their own, because embedded viewers have no Databricks identity for a filter to evaluate. The tenant id has to travel in the embed token, with the dashboard SQL joining on it. We'd restrict the characters the tenant key may contain, and load every dashboard with a real token before each deploy.

Do I need customer-managed keys on Databricks? #

Only if a regulator or a customer requires key custody, because data is encrypted at rest either way. The managed services key covers control plane data such as notebooks, secrets and query history, and the workspace storage key covers your workspace storage bucket; a classic workspace can use both. Neither covers copies of the data outside the workspace, so list those before promising what revoking a key does.

How do I control what Databricks serverless compute can reach? #

With network connectivity configurations and serverless egress control policies, since there's no cluster in your network to attach rules to. On Azure the private network gateway, in Public Preview, adds one route into your VNet and on-premises network. Blob storage always takes the Azure service endpoint path, whatever the gateway is set to.