What you will be able to do
- State the privileges and compute needed to create an ABAC row filter or column mask policy
- Write a row filter policy that passes tagged columns and constants to a UDF through USING COLUMNS
- Write a column mask policy and explain how ON COLUMN binds the masked value
- Predict how ABAC behaves at query time on old runtimes, after a tag or UDF is deleted, and when policies conflict
1.Permissions and compute requirements
Two privileges are needed to create an ABAC policy, one on the attachment point and one on the logic. You "must have MANAGE on the securable object where the policy is attached (catalog, schema, or table) or own the securable object, and EXECUTE" on the UDF that implements the filter or mask. Attaching a policy at the metastore level requires a metastore admin. Looking at policies needs less: "Viewing policies (show, describe) requires READ METADATA or MANAGE on the securable object, or object ownership." The environment also has to support the policy. Databricks requires "Databricks Runtime 16.4 or above, or serverless compute." The target objects must already carry governed tags. You can create a policy from the Policies tab in Catalog Explorer, with the CREATE POLICY statement, or with the REST APIs, SDKs and Terraform.
Checkpoint 1 of 5· Check yourself
A data steward wants to attach a column mask policy to the prod.customers schema that calls the UDF gov.fn.mask_ssn. The steward does not own the schema. Which privileges are sufficient?
Creating a policy needs MANAGE on (or ownership of) the attachment point plus EXECUTE on the UDF. READ METADATA is only enough to view policies.
“you must have MANAGE on the securable object where the policy is attached (catalog, schema, or table) or own the securable object, and EXECUTE”Source: docs.databricks.com
Sources1
2.Row filter policies
A row filter policy references a UDF that returns a boolean for each row. "Rows where the function returns FALSE are excluded from query results." The policy does not name the column the UDF reads. Instead, MATCH COLUMNS finds the column by its tag, and USING COLUMNS passes it to the function.
CREATE FUNCTION filter_by_region(region STRING, allowed STRING) RETURNS BOOLEAN
RETURN region = allowed;
CREATE POLICY regional_access_emea
ON CATALOG sales
ROW FILTER filter_by_region
TO `emea team`
FOR TABLES
MATCH COLUMNS has_tag('region') AS rgn
USING COLUMNS (rgn, 'EMEA');Passing constants is what lets you reuse one UDF: another policy could call filter_by_region with 'APAC'. Constants can be quoted strings, numeric literals, booleans or NULL. Write the UDF in SQL where you can. "SQL UDFs are recommended for better performance." Python UDFs registered in Unity Catalog also work, but the optimizer cannot inline them. One trap is specific to row filters. If the rgn alias matches more than one column in a table, the engine does not know which value to pass.
Checkpoint 2 of 5· Check yourself
A table in sales has two columns, ship_region and bill_region, and both are tagged region. What happens when an EMEA team member queries it under regional_access_emea?
A USING COLUMNS alias must resolve to a single column. When it matches several, the engine cannot choose one, so the query fails rather than guessing.
“matches more than one column, the engine cannot determine which column to pass to the UDF, and the query fails with an error.”Source: docs.databricks.com
Sources2
3.Column mask policies
A column mask policy references a UDF that takes the column value and returns either that value or a masked version. The difference from a row filter is the ON COLUMN clause. "The masked column value is bound automatically as the first argument from the ON COLUMN clause". USING COLUMNS therefore carries only the extra arguments. In the example below, the constant 4 tells the function how many trailing digits to reveal.
CREATE FUNCTION mask_ssn(ssn STRING, show_last INT) RETURNS STRING
RETURN CONCAT('***-**-', RIGHT(ssn, show_last));
CREATE POLICY mask_ssn_columns
ON CATALOG hr_catalog
COLUMN MASK mask_ssn
TO `account users` EXCEPT `compliance team`
FOR TABLES
MATCH COLUMNS has_tag_value('pii', 'ssn') AS ssn_col
ON COLUMN ssn_col
USING COLUMNS (4);Two rules matter here. First, "The return type must match or be castable to the column's data type." Second, a masked column cannot feed another policy: "If a column is masked by one policy, it cannot be used as an input argument in the USING COLUMNS clause of another policy." This rule stops a row filter from reading a value that is supposed to be hidden.
Checkpoint 3 of 5· Fill the gap
This schema-level policy should mask only columns whose pii tag has the value ssn. Which built-in function completes it?
CREATE POLICY mask_ssn
ON SCHEMA prod.customers
COLUMN MASK ssn_to_last_nr
TO us_analysts EXCEPT admins
FOR TABLES
MATCH COLUMNS ? ('pii', 'ssn') AS ssn
ON COLUMN ssn
USING COLUMNS (4);has_tag_value checks for a specific key-value pair. has_tag takes only a key and would match every pii column, whatever its value.
Source: docs.databricks.com4.Enforcement at query time: fail-closed, dependencies and conflicts
Policies are evaluated each time a query runs, for the user who runs it. "Different users may see different results from the same query because policy evaluation depends on the user's identity, group memberships, and the tags" on the data. Unity Catalog finds every policy whose scope covers the table. It checks whether the user is in TO and not in EXCEPT, then evaluates the table and column conditions. The runtime then enforces the result as a secure view over the table scan. This is the same mechanism that table-level filters and masks use.
"ABAC follows a fail-closed model, where Databricks defaults to denying access if it cannot verify security." So the query on 15.4 is denied; it neither returns raw data nor quietly masks it. The same rule covers operations that cannot enforce filters or masks. Examples include deep and shallow cloning, OpenSharing and AI Search index syncing. "To run them, the principal must be listed in the EXCEPT clause of every ABAC policy that applies to the table."
Policies also fail closed when something they depend on is removed. If you delete a governed tag that a policy references, every query in that policy's scope fails with UC_ABAC_UNKNOWN_TAG_POLICY. "This occurs even if the tag was not applied to the queried tables." If you delete a referenced UDF, queries fail with UC_DEPENDENCY_DOES_NOT_EXIST. Databricks also refuses to drop a column that carries a governed tag. This affects pipelines that change their schema.
Checkpoint 4 of 5· Put it in order
A declarative pipeline fails because it tries to drop a column that carries a governed tag. Put the steps that unblock it in order.
- 1.Run the pipeline so the schema change succeeds
- 2.Reapply the tag to the relevant columns
- 3.A user with the required tag permissions removes the governed tag from the column
The tag blocks the drop, so it must be removed first and then reapplied after the schema change. If the tag is not reapplied, queries fail because the policy is still in scope.
“a user with the required tag permissions must remove the tag, run the pipeline so the schema change succeeds, and then reapply the tag”Source: docs.databricks.com
Conflicts follow the same rule as on the previous page: one distinct row filter per table and one distinct mask per column, for each user. Overlap is allowed when it is harmless. "Multiple ABAC policies can coexist for the same table or column if they result in the same effective filter or mask." When the effective filters or masks differ, access is blocked with an error such as UC_ABAC_MULTIPLE_ROW_FILTERS. To diagnose it, "Use SHOW EFFECTIVE POLICIES to see all policies that apply to the table."
Checkpoint 5 of 5· Exam question
An engineering team is evaluating how attribute-based access control (ABAC) governed tags and policies behave across a Unity Catalog metastore before rolling them out broadly. Which of the following statements are accurate? (Select all that apply.)(Select 3)
Correct answers: A, B, C — A single ABAC policy attached at the catalog level automatically extends to new tables created later in that catalog, as long as those tables carry the tag the policy's `WHEN` clause matches.; Governed tags applied at the catalog level propagate down to schemas and tables beneath it, so a lower-level object inherits the tag unless a more specific tag overrides it closer to the object.; A tag applied to a table does not automatically apply to that table's columns, so column-level ABAC policies require the columns themselves to carry a matching tag.
- A. This statement is accurate: attaching a policy at the catalog level lets it apply automatically to any table that later acquires the matching tag, which is the core scaling benefit of ABAC over manually attaching filters table by table.
- B. This statement is accurate: tags follow the catalog-to-schema-to-table hierarchy by default, so an object inherits a tag from its parent unless a more specific tag is set closer to that object.
- C. This statement is accurate: tags do not flow from a table down to its columns, so a column-level policy condition only matches columns that have been tagged directly, even if the parent table carries a matching tag.
- D. This statement is inaccurate: ABAC GRANT policies only add privileges when their tag condition is met, and documentation is explicit that they cannot revoke access a principal already holds through a direct grant made outside the policy.
- E. This statement is inaccurate: DENY policies are currently limited in scope to the `MANAGE ACCESS CONTROL` privilege, so they do not universally override every GRANT regardless of which privilege is involved.
- F. This statement is inaccurate: row filter and column mask policies apply to table-level securables such as tables, materialized views, and streaming tables, not to volumes or registered models.
Sources3
Exam traps
Each one states something that sounds right. Open it to see what is actually true.
1.The column being masked must be listed first in USING COLUMNS so the UDF receives it.Why is that wrong?
The masked column is bound automatically from ON COLUMN as the UDF's first argument. USING COLUMNS supplies only the additional arguments.
Covered in Column mask policies
2.Deleting a governed tag only affects tables that actually carry that tag.Why is that wrong?
If a policy references the deleted tag, every query in the policy's scope fails, including queries on tables that never had the tag.
Covered in Enforcement at query time: fail-closed, dependencies and conflicts
3.Compute that cannot enforce ABAC, such as a runtime older than 16.4, simply returns the unfiltered data.Why is that wrong?
ABAC fails closed: access is denied unless the user is exempted from the policy through EXCEPT.
Covered in Enforcement at query time: fail-closed, dependencies and conflicts
Practise it for real
Protect SSN columns across a whole schema with one tag-driven column mask policy, then confirm which policies apply to a table.
1.Run CREATE GOVERNED TAG pii with DESCRIPTION and VALUES ('ssn', 'ccn', 'dob'), as in the governed tag example.
Why: Policies match on governed tags, and allowed values stop stewards from inventing variants such as 'SSN'.
You should see: The pii tag appears under Govern > Governed Tags, marked with a lock icon.
2.In Catalog Explorer, apply pii = ssn directly to the SSN column of a table in your target schema.
Why: Column tags are never inherited, so each sensitive column must be tagged itself.
You should see: The column shows the governed pii tag with the value ssn.
3.Create the ssn_to_last_nr function and the mask_ssn policy ON SCHEMA from the policy example, replacing us_analysts and admins with your own groups.
Why: One schema-level policy covers every current and future table whose columns carry pii = ssn.
You should see: The policy appears on the schema's Policies tab.
4.Run SHOW EFFECTIVE POLICIES against the tagged table, then query it as a member of the TO group and as a member of the EXCEPT group.
Why: Policies are evaluated per user, so the same query should return different results for the two users.
You should see: The policy is listed. The TO user sees only the last 4 characters of the SSN, and the exempt user sees the full value.
Stuck? Get a nudge
If queries fail on the tagged table, check that you are on Databricks Runtime 16.4 or above, or on serverless compute.
Sources
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“Viewing policies (show, describe) requires READ METADATA or MANAGE on the securable object, or object ownership.”
↩︎ Permissions and compute requirements“Databricks Runtime 16.4 or above, or serverless compute.”
↩︎ Permissions and compute requirements“you must have MANAGE on the securable object where the policy is attached (catalog, schema, or table) or own the securable object, and EXECUTE”
↩︎ Checkpoint - 2.
“Rows where the function returns FALSE are excluded from query results.”
↩︎ Row filter policies“SQL UDFs are recommended for better performance.”
↩︎ Row filter policies“The return type must match or be castable to the column's data type.”
↩︎ Column mask policies“The masked column value is bound automatically as the first argument from the ON COLUMN clause”
↩︎ Exam trap 1“It accepts aliases for columns that match a tag-based expression, or constant values”
↩︎ Prediction - 3.https://docs.databricks.com/aws/en/data-governance/unity-catalog/abac/policy-evaluationOfficial docs
“If a column is masked by one policy, it cannot be used as an input argument in the USING COLUMNS clause of another policy.”
↩︎ Column mask policies“To run them, the principal must be listed in the EXCEPT clause of every ABAC policy that applies to the table.”
↩︎ Enforcement at query time: fail-closed, dependencies and conflicts“Multiple ABAC policies can coexist for the same table or column if they result in the same effective filter or mask.”
↩︎ Enforcement at query time: fail-closed, dependencies and conflicts“Use SHOW EFFECTIVE POLICIES to see all policies that apply to the table.”
↩︎ Enforcement at query time: fail-closed, dependencies and conflicts“This occurs even if the tag was not applied to the queried tables.”
↩︎ Exam trap 2“ABAC follows a fail-closed model, where Databricks defaults to denying access if it cannot verify security.”
↩︎ Exam trap 3“matches more than one column, the engine cannot determine which column to pass to the UDF, and the query fails with an error.”
↩︎ Checkpoint“a user with the required tag permissions must remove the tag, run the pipeline so the schema change succeeds, and then reapply the tag”
↩︎ Checkpoint