
Data Governance on Databricks: A Unity Catalog Runbook
A step-by-step model for governing a Databricks lakehouse with Unity Catalog: schemas as the governance unit, governed tags, three-tier roles from Entra ID, tag-driven row filters and column masks, service principals, and governance as code.
Radek Řezáč
Governance on a lakehouse fails in two typical ways: rights are scattered across BI tools, notebooks and ad-hoc grants, or the model is so manual that every new user or table needs an engineer. This article describes a model that avoids both. Every access right and every protection is defined once, in Unity Catalog, deployed as code, and switched on by tags. It is based on a runbook written for a finance data platform migrating from SQL Server and SSAS to Databricks; the names here are generic.
Ten Rules
- One rule book. Every access right and protection is defined once, in Unity Catalog — never in the BI tool, a notebook or an application.
- Business sees Gold only. Bronze and Silver are engineering layers. Business users read certified views of their Gold domain schema.
- The schema is the unit. Each schema has one owner, one writing service principal and one rule for who may read it.
- Tags carry the meaning. Layer, source, domain, classification, personal data and row scope are governed tags.
- Tags switch protection on. A column tagged as personal is masked; a table tagged for row scope is filtered — by one policy per rule.
- People come from Entra ID. No local accounts; SSO with MFA.
- Roles, not people, get rights. Users join a functional role; rights go only to access roles; persona roles join the two.
- Business owners decide. Each Gold domain has a business owner who approves who joins its roles and which rows they see.
- Service principals write, people read. In production only service principals write data.
- Everything as code. Grants, tags, policies and memberships come from Git; anything else is drift.
The Namespace
One catalog per environment (dev, test, prod), each bound to its own workspace. Inside, Bronze and Silver are named after the source system, Gold after the business domain:
| Layer | Schema | Holds | Who can see it |
|---|---|---|---|
| Bronze | erp_bronze | raw copy of the source | engineers only |
| Silver | erp_silver | cleansed, conformed data | engineers only |
| Gold | finance_gold | dimensions, facts, metric views, certified serving views | business users, through certified views |
| Shared | shared, control, dq | common functions, run control and entitlements, data-quality results | engineers and operators |
When a second source arrives, it adds crm_bronze and crm_silver and feeds the same finance_gold. Schemas are created and owned by the CI service principal, so a running job can never re-grant, drop or untag an object.
CREATE SCHEMA IF NOT EXISTS erp_bronze COMMENT 'Source raw landing, append-only';
CREATE SCHEMA IF NOT EXISTS erp_silver COMMENT 'Source cleansed and conformed';
CREATE SCHEMA IF NOT EXISTS finance_gold COMMENT 'Dimensions, facts, certified serving views';
ALTER SCHEMA erp_bronze SET TAGS ('layer' = 'bronze', 'source' = 'erp');
ALTER SCHEMA erp_silver SET TAGS ('layer' = 'silver', 'source' = 'erp');
ALTER SCHEMA finance_gold SET TAGS ('layer' = 'gold', 'business_domain' = 'finance');
Because the meaning sits in tags, grant generation, policy scope and audit queries never have to parse a schema name.
Governed Tags
All tag keys are governed tags: account-level tag policies with closed value lists. Only the CI service principal and the data governance steward hold ASSIGN, so a free-text value or an unauthorised assignment is rejected by the platform rather than found later in a review.
| Family | Key | Values | Drives |
|---|---|---|---|
| Namespace | layer, source, business_domain | bronze / silver / gold …, one per source and domain | grants and policy scope |
| Classification | classification | public, internal, confidential, restricted | certification and audit |
| Classification | personal_data | none, personal, sensitive_personal | certification and masking |
| Policy | rls | entitlement | which tables are row-filtered |
| Policy | entitlement_axis | legal_entity, organisational_unit, … | which column the row filter evaluates |
One tag, one meaning. Classifying a column as personal is what masks it — there is no second "mask me" tag to forget. Tags are part of the DDL change that creates the column, so no window exists in which a personal column is live but unmasked.
Identities: Three Ways to Bring Entra ID Users In
What has to be decided is where the functional role lives and who changes a membership:
| Automatic identity management | Entra ID SCIM | Databricks-managed groups | |
|---|---|---|---|
| Verdict | Recommended | Fallback | Dev or a dated interim only |
| Functional role lives in | Entra ID | Entra ID, copied | Databricks |
| Nested Entra groups | yes | no | n/a |
| Change takes effect | next sign-in | next provisioning cycle (~40 min) | when someone acts |
| Leaver | loses access automatically | deactivated at next cycle | stays until removed |
Rules that hold for every option:
- Users, groups and service principals exist at the account level only — no workspace-local groups.
- Workspace entitlements are assigned per persona group, never per user; cluster creation is never granted.
- People use SQL warehouses, serverless or standard-access-mode compute only — all of them enforce row filters and masks.
- Personal access tokens are prohibited: engineers use OAuth U2M, pipelines use service principals with OAuth M2M.
The Three-Tier Role Model
Users are members only of functional roles; privileges are granted only to access roles; persona roles join the two.
| Tier | Example | Owner | Purpose |
|---|---|---|---|
| Functional role | dp-fr-finance-controller-north | business owner / IAM | who the person is in the organisation |
| Persona role | dp-prod-pr-finance-consumer | data platform | one job profile |
| Access role | dp-prod-ar-finance-gold-serve | data platform | one schema × one privilege level |
An organisation change is one membership change; a new schema is one access role added to the personas that need it. Grants stay few and stable. Access-role levels are read (USE SCHEMA + SELECT), write (+ MODIFY, dev and test only), serve (SELECT on certified objects only) and execute, plus two exemption roles: pii-unmasked and unrestricted.
The mapping lives in a reviewed file, so adding a team is a pull request, not a console change:
# governance/personas.yml - functional -> persona -> access mapping
access_roles:
erp-silver-read: {envs: [dev, test, prod]}
finance-gold-write: {envs: [dev, test]}
finance-gold-serve: {envs: [dev, test, prod]}
shared-execute: {envs: [dev, test, prod]}
personas:
finance-consumer:
access: [finance-gold-serve, shared-execute]
functional: [dp-fr-finance-controller-north, dp-fr-finance-controller-south]
finance-engineer:
access: [erp-silver-read, finance-gold-write, shared-execute]
functional: [dp-fr-analytics-engineer]
A small script built on the Databricks SDK creates the persona and access groups, nests access ← persona ← functional, and assigns personas to the workspace. It runs in the CI/CD pipeline and is re-runnable.
Grants Generated From Tags
Grants go to access roles and workload service principals only, generated from the schema tags — a new source schema gets its grants by being tagged, not by new grant code.
GRANT USE CATALOG ON CATALOG `${catalog}` TO `dp-${env}-ar-finance-gold-serve`;
GRANT USE SCHEMA ON SCHEMA finance_gold TO `dp-${env}-ar-finance-gold-serve`;
GRANT SELECT ON TABLE finance_gold.vw_profit_and_loss TO `dp-${env}-ar-finance-gold-serve`;
GRANT USE SCHEMA, SELECT ON SCHEMA erp_silver TO `${sp_finance_gold}`;
GRANT USE SCHEMA, SELECT, MODIFY ON SCHEMA finance_gold TO `${sp_finance_gold}`;
Binding consequences:
- No human group holds
MODIFYin production. - Consumers hold no grant on any Bronze or Silver schema. A request for one means a serving view is missing.
- A consumer never receives schema-wide
SELECTon Gold — onlySELECTon named, certified objects.
Service Principals
One workload service principal per source × layer function — ingest, transform, Gold build — so the blast radius of a defect equals the schema boundary. A shared per-layer principal would let a bug in one source's ingest write another source's Bronze.
- DDL by CI, DML by workload SP. Workload principals hold
MODIFY/SELECTbut are never owners. - Every job runs as its service principal via
run_asin the bundle; a personal identity never runs a production job. - Secrets are scoped to the one principal that needs them (for example, only the ingest SP can read the source database credentials).
- Workload SPs are exempt from row filters and masks, because builds must read complete data — listed by name in every policy's
EXCEPTclause, never implied by ownership.
Row-Level Security From Tags
One ABAC row-filter policy per entitlement axis, defined once on the Gold schema. Row scope is data, not code: an entitlement table holds one row per functional role and key, loaded with a MERGE from a reviewed CSV whose required approver is the business owner.
CREATE OR REPLACE FUNCTION shared.fn_rls_legal_entity(legal_entity_key STRING)
RETURNS BOOLEAN
RETURN EXISTS (
SELECT 1 FROM control.entitlements_legal_entity e
WHERE is_account_group_member(e.functional_role)
AND e.effect = 'allow' AND (e.key_value = legal_entity_key OR e.key_value = '*')
AND current_date() BETWEEN e.valid_from AND coalesce(e.valid_to, DATE'9999-12-31')
) AND NOT EXISTS (
SELECT 1 FROM control.entitlements_legal_entity e
WHERE is_account_group_member(e.functional_role)
AND e.effect = 'deny' AND e.key_value = legal_entity_key
AND current_date() BETWEEN e.valid_from AND coalesce(e.valid_to, DATE'9999-12-31')
);
CREATE OR REPLACE POLICY rls_legal_entity
ON SCHEMA finance_gold
ROW FILTER shared.fn_rls_legal_entity
TO `account users`
EXCEPT `dp-${env}-ar-finance-unrestricted`, `${sp_finance_gold}`
FOR TABLES
WHEN has_tag_value('rls', 'entitlement')
MATCH COLUMNS has_tag_value('entitlement_axis', 'legal_entity') AS k
USING COLUMNS (k);
Rules that always hold:
- Precedence: unrestricted override → explicit deny → explicit allow → default deny. A tagged table with no matching entitlement row returns nothing.
- Totals by construction: the filter removes rows before aggregation, so every Gold aggregate, metric view and dashboard total covers only permitted rows.
- The policy sits on the table; the user reads the view. A row filter cannot be attached to a view — views read the filtered table under the querying user.
- Validity dates matter: a row past its
valid_tostops granting access without a deployment.
When migrating from SSAS, the rules are converted, not invented: a cube role's Windows group becomes a functional role, AllowedSet / DeniedSet become allow / deny rows, and dynamic UserName() security becomes current_user() against the same entitlement table.
If tag-driven policies are not yet available on your runtime, the same tags can generate one ALTER TABLE … SET ROW FILTER per tagged table — the same model with more statements, and the exemptions moved into a wrapper function.
Column Masking From Tags
A mask policy on the catalog matches columns by classification tag. The function only masks; the policy's EXCEPT list decides who sees clear values.
CREATE OR REPLACE FUNCTION shared.fn_mask_personal(v STRING) RETURNS STRING
RETURN CASE WHEN v IS NULL THEN NULL ELSE '***' END;
CREATE OR REPLACE POLICY mask_personal
ON CATALOG `${catalog}`
COLUMN MASK shared.fn_mask_personal
TO `account users`
EXCEPT `dp-${env}-ar-pii-unmasked`, `${sp_erp_ingest}`, `${sp_erp_transform}`, `${sp_finance_gold}`
FOR TABLES
MATCH COLUMNS has_tag_value('personal_data', 'personal') OR has_tag_value('personal_data', 'sensitive_personal') AS c
ON COLUMN c;
Because the policy is on the catalog, it covers Bronze, Silver, Gold and data-quality quarantine alike — an engineer reading production Silver sees personal columns masked exactly as a consumer does in Gold. Deploy the mask policy before the first personal column lands.
Serving BI Tools Correctly
The BI storage mode decides whose scope applies:
| How the BI tool reads | Whose scope applies | Requirement |
|---|---|---|
| Live connection | the viewer's own, on every query | per-user OAuth with Entra ID — never a shared technical account |
| Extract | the refresh principal's, once at refresh | one extract per entitlement scope; the extract principal is entitled, not exempt |
A Gold object is published only after a certification gate: business description, owners and steward recorded, the full classification tag set (including personal_data on every column), row-scope tags where needed, a freshness expectation, DQ expectations and a recorded storage mode. Only then is SELECT generated for the serve role.
Operating It: Governance as Code
| Control | Rule |
|---|---|
| Everything in Git | groups, memberships, grants, ownership, tags, entitlement rows, functions, policies |
| Deployment | CI/CD under the CI service principal, promoted dev → test → prod |
| Test = prod | test carries the same policies and grants, so the model is proven before cutover |
| Daily drift check | reports anything present but not in Git, any user directly in a persona or access role, any grant to a persona |
| Break-glass | incident only, with ticket, owner and expiry; the equivalent change is committed before closure |
| Audit | system tables (access, lineage) reviewed monthly by Security |
Worked Example: A New Controller Joins
- The new controller requests access to finance reporting.
- The business owner adds them to
dp-fr-finance-controller-northin Entra ID. - At sign-in, the user appears in the Databricks account automatically.
- The functional role is already a member of the
finance-consumerpersona — in Git. - The persona already holds
finance-gold-serve→SELECTon certified views. - The entitlement row for that functional role is already approved.
- The user opens the dashboard and sees their region's rows, with personal names masked.
No grant was typed, no engineer was involved, no BI filter was set up. When the controller leaves, disabling the Entra account removes everything.
Conclusion
The model rests on a few ideas: the schema is the governance unit, tags carry meaning and switch protection on, rights flow through three role tiers, row scope is approved data owned by the business, and everything is deployed as code with drift detection. The result is a platform where onboarding a user is a group membership, onboarding a table is a set of tags, and every protection is provable from Git.
Data Quality on Databricks: A Framework for Lakeflow Jobs
A step-by-step data quality framework for a Databricks lakehouse built on Lakeflow Jobs: three lines of defence, a rule catalogue seeded from Git, a runner that warns, quarantines or fails, thresholds and alerts routed to owner groups, monitoring that never gates, and a scorecard.
Data Platform Solution Architect: Roles, Responsibilities and Design Steps
What a data platform solutions architect does and how to design a data platform step by step: roles, responsibilities, pipeline foundations, architecture patterns, 23 design steps in six phases, a validation checklist and common pitfalls.