What you will be able to do
- Create and assign tags, configure inheritance and propagation, and attach masking policies to tags
- Find tag and policy assignments with TAG_REFERENCES and POLICY_REFERENCES
- Classify a table with EXTRACT_SEMANTIC_CATEGORIES and apply the results as system tags
- Audit who read or wrote which columns using ACCESS_HISTORY
- Enable and schedule Trust Center scanner packages and interpret their findings
1.Tagging objects and tag-based masking
A tag is a named label set on databases, schemas, tables, views and columns, such as governance.tags.pii = 'sensitive'. A tag value is always a string of up to 256 characters. ALLOWED_VALUES limits a tag to a list of up to 5,000 values, and MULTI_VALUE = TRUE lets one object hold several values for the same tag.
create or replace table hr.data.user_info( email string with masking policy governance.policies.email_mask with tag (governance.tags.pii = 'sensitive') ) with tag (governance.tags.pii = 'sensitive');Tags reach objects you never tagged directly in two ways. Inheritance: a tag set on a database or schema applies to every table and view inside it. Propagation: a tag created with PROPAGATE = ON_DEPENDENCY, ON_DATA_MOVEMENT or ON_DEPENDENCY_AND_DATA_MOVEMENT follows the data to downstream objects. When propagated values conflict and ON_CONFLICT is not set, the tag's value becomes the string CONFLICT. Setting ON_CONFLICT to ALLOWED_VALUES_SEQUENCE makes the order of the allowed values decide instead.
Tag-based masking means you attach the masking policy to the tag rather than to each column. The workflow has four steps:
- Create the tag with CREATE TAG.
- Create the masking policy. The policy body can call SYSTEM$GET_TAG_ON_CURRENT_COLUMN to branch on the tag's value.
- Attach the policy to the tag:
ALTER TAG my_tag SET MASKING POLICY my_masking_policy;. - Set the tag on a database, schema, table or view, for example
ALTER TABLE my_table SET TAG my_tag = 'protected';.
Every column whose data type matches the policy signature is then protected, including columns in tables created later under a tagged schema. A tag can hold only one masking policy per data type, but one statement can attach a STRING policy and a NUMBER policy together. You cannot drop a tag while a masking policy is assigned to it, and you cannot drop the policy while it is assigned to the tag.
For tag-based masking on a database or schema, the role needs one of two privilege sets. The centralized option is global APPLY MASKING POLICY plus global APPLY TAG. The delegated option gives the schema owner global APPLY MASKING POLICY plus APPLY on the specific tag. One ownership interaction catches teams out: if a schema owner sets a tag and a different role then attaches a masking policy to that tag, the schema owner can no longer unset the tag or change its value. Snowflake blocks this so the protected columns stay masked.
Checkpoint 1 of 5· Check yourself
The masking policy ssn_mask is attached to the tag security, and that tag is set on several schemas. The privacy officer needs to change which roles see plain text, and the tagged columns must stay masked the whole time. What should they run?
While a masking policy is assigned to a tag, it cannot be dropped or replaced, so CREATE OR REPLACE and DROP both fail. ALTER MASKING POLICY … SET BODY changes the policy in place, so the columns stay masked. Unsetting the tag first would work, but the data would be unprotected until the tag is set again.
“Policy <policy_name> cannot be dropped/replaced as it is associated with one or more entities.”Source: docs.snowflake.com
2.Finding tags and policy assignments
Inheritance and propagation make it easy to lose track of which tags and policies apply where, so check before you change anything. The Account Usage view TAG_REFERENCES lists every tag assignment and its string value across the account. Query it before you set a tag-based policy on a schema, so you do not collide with tags that are already there.
SELECT *
FROM SNOWFLAKE.ACCOUNT_USAGE.TAG_REFERENCES
WHERE TAG_NAME = 'my_tag';To answer which policy protects a particular table, use the Information Schema table function POLICY_REFERENCES. For each protected column it returns the policy name, and for tag-based assignments it also returns TAG_DATABASE, TAG_SCHEMA, TAG_NAME and POLICY_STATUS. POLICY_STATUS shows whether the tag-based assignment is actually in effect. The Account Usage views MASKING_POLICIES and POLICY_REFERENCES give the same information across the whole account.
SELECT *
FROM TABLE(INFORMATION_SCHEMA.POLICY_REFERENCES(
REF_ENTITY_DOMAIN => 'TABLE',
REF_ENTITY_NAME => 'my_database.my_schema.my_table'
));For an individual query, Snowsight's query history records the SQL the user ran, and the Query Profile names the masking policies that query used. The Account Usage QUERY_HISTORY view stores the query text but not the policy names, so the Query Profile is where you confirm which policy masked a particular result.
Checkpoint 2 of 5· Check yourself
A compliance analyst needs to prove which masking policy hid the values in the result of one particular query that a user ran last week. Where can they find that?
Only the Query Profile names the masking policies that a specific query used. QUERY_HISTORY keeps the SQL text but not the policy names. TAG_REFERENCES and MASKING_POLICIES describe tag assignments and policies across the account, not what happened in one query.
“The masking policy names that were used in a specific query can be found in the Query Profile.”Source: docs.snowflake.com
3.Classifying columns with EXTRACT_SEMANTIC_CATEGORIES
Classification samples a table's data and metadata and suggests what each column contains. EXTRACT_SEMANTIC_CATEGORIES takes a table, view, external table or materialized view and returns a JSON object for each supported column. The function needs a running warehouse. It samples 10,000 rows by default, and you can pass any number from 1 to 10,000. Columns that contain only NULLs are skipped. Each column's recommendation includes a semantic_category such as PASSPORT, a privacy_category of IDENTIFIER, QUASI-IDENTIFIER or SENSITIVE, a confidence of HIGH, MEDIUM or LOW, and a coverage ratio. Lower-ranked candidates appear under alternates.
Classification runs in two steps: extract, review, then apply. The stored procedure ASSOCIATE_SEMANTIC_CATEGORY_TAGS takes the extraction result and sets the classification system tags on the columns. The exam guide refers to this step as ASSOCIATE_SEMANTIC_CATEGORIES. The procedure applies only each column's top-level recommendation, never the alternates. To use an alternate, save the results to a table, edit them with OBJECT_INSERT, and pass the edited table to the procedure, or set the tag yourself with ALTER TABLE … MODIFY COLUMN … SET TAG. The procedure runs with caller's rights. To remove a classification tag, use MODIFY COLUMN … UNSET TAG.
CALL ASSOCIATE_SEMANTIC_CATEGORY_TAGS('mydb.my_schema.hr_data', EXTRACT_SEMANTIC_CATEGORIES('mydb.my_schema.hr_data'));Snowflake now marks both routines as legacy. The current path is SYSTEM$CLASSIFY. Called with {'auto_tag': true}, it sets the recommended tags as soon as classification finishes, and it must be called with the role that owns the schema. Its results show exactly which tags were set: snowflake.core.semantic_category with a value such as DATE_OF_BIRTH, and snowflake.core.privacy_category with a value such as QUASI_IDENTIFIER. You can also pass a classification profile to it in place of an options object.
Checkpoint 3 of 5· Check yourself
A data engineer wants the recommended classification tags set on every column of a table the moment classification finishes, with no separate apply step. Which call does that?
The auto_tag option makes SYSTEM$CLASSIFY set the recommended system tags when classification completes, and it requires the schema owner role. EXTRACT_SEMANTIC_CATEGORIES only returns suggestions, and NULL options leave every column untagged.
“Sets the recommended classification system tags on the columns in the specified object when the classification process is complete.”Source: docs.snowflake.com
4.Auditing reads and writes with ACCESS_HISTORY
ACCESS_HISTORY answers the question of who touched which data. The view lives in SNOWFLAKE.ACCOUNT_USAGE, with an organization-wide copy in ORGANIZATION_USAGE, and keeps one year of history. Each row records one query, identified by query_id, query_start_time and user_name, along with arrays describing the objects and columns that query read or wrote.
| Column | What it records |
|---|---|
| direct_objects_accessed | Objects and columns named in the query, including those reached through * |
| base_objects_accessed | The underlying objects the query actually needed, including UDFs and external functions |
| objects_modified | Objects written, with baseSources and directSources for each target column |
| object_modified_by_ddl | DDL changes, including setting policies and adding, changing or removing tags |
| policies_referenced | Masking and row access policies enforced during the query |
| parent_query_id / root_query_id | How nested stored procedure calls relate to each other |
The difference between direct and base objects is what makes column-level auditing possible. Suppose an analyst queries a view built on t that calls a UDF. The direct column records the view, which is what the analyst asked for. The base column records the table and the UDF, which is the data that was actually read. For writes, the baseSources and directSources fields inside objects_modified show which source columns fed each target column, and this gives you column lineage. Coverage has a gap: certain short-running transactional queries that appear in QUERY_HISTORY are missing from ACCESS_HISTORY. The AGGREGATE_ACCESS_HISTORY view covers those queries, aggregating repeated queries into one-minute intervals.
Checkpoint 4 of 5· Check yourself
For a quarterly audit, you must show which row access and masking policies were enforced on each query against the sales table over the last three months. Where do you get this for every query in bulk?
ACCESS_HISTORY's policies_referenced column records the masking and row access policies enforced during each query. EXPLAIN and the Query History page never show the row access policy name, signature or body. direct_objects_accessed lists the objects and columns the query named, not the policies.
“In the EXPLAIN command result and the Query History page, Snowflake does not show users any row access policy information”Source: docs.snowflake.com
5.Trust Center scanners and Horizon governance in Snowsight
The Trust Center is the Snowsight page, under Governance & security » Trust Center, that checks an account for security risks and suggests how to fix them. Managing it requires a role that has the SNOWFLAKE.TRUST_CENTER_ADMIN application role. Its checks are organized into scanner packages:
- Security Essentials is always on and cannot be deactivated. It runs on a fixed schedule at no serverless compute cost and checks MFA enrollment, authentication policies and an account-level network policy.
- CIS Benchmarks evaluates the account against the CIS Snowflake Benchmarks. It runs once a day by default, and you can change the schedule.
- Threat Intelligence flags risky users, logins without MFA, inactive users and unusual failure rates.
- AI Security monitors AI agents and AI-related configuration.
Every package except Security Essentials is off until you enable it on the Manage scanners tab, and enabled scanners incur serverless compute cost. You can switch individual scanners on or off, run a package or a single scanner on demand, and give a scanner its own schedule, which then overrides the package schedule. Event-based scanners can only be enabled or disabled. Disabling a package disables all of its scanners, including ones you enabled individually. Findings appear on the Violations tab with the CIS section number, and selecting a finding opens a Remediation panel.
Horizon Catalog carries these policies beyond Snowflake's own engine. When Apache Spark queries Apache Iceberg tables through Snowflake Horizon Catalog, Snowflake still enforces the dynamic data masking policies on those tables. Calls to the Horizon Iceberg REST Catalog API also appear in ACCESS_HISTORY with event_source = 'horizon_irc', alongside snowflake_sql for ordinary queries, so you can audit engine access the same way as any other query.
Checkpoint 5 of 5· Check yourself
Your data engineering team queries Apache Iceberg tables from Apache Spark through Snowflake Horizon Catalog. One of those tables has a dynamic data masking policy on its ssn column that shows plain text only to the PAYROLL role. A Spark job runs without PAYROLL authorization. What does it get back for ssn?
Horizon Catalog extends Snowflake's governance beyond its own engine. When Spark reads Iceberg tables through it, Snowflake still enforces the dynamic data masking policies on those tables. Unauthorized callers get the masked value, not plain text, an error or a token.
“Snowflake supports enforcing dynamic data masking policies on Apache Iceberg tables that you query from Apache Spark™ through Snowflake Horizon Catalog.”Source: docs.snowflake.com
Practise it for real
Protect every STRING column in a table with a tag-based masking policy and confirm the assignment
1.Create a tag that accepts only two values:
create tag governance.tags.pii allowed_values 'sensitive','public';Why: ALLOWED_VALUES stops stewards from inventing inconsistent labels.
You should see: A tag named PII in governance.tags. Setting it to any other value fails.
2.Create a STRING masking policy whose CASE returns
valfor ANALYST and '*********' for everyone else.Why: A tag holds one policy per data type, and the policy masks only columns whose type matches its signature.
You should see: The policy appears in SHOW MASKING POLICIES.
3.Attach the policy to the tag with
ALTER TAG governance.tags.pii SET MASKING POLICY <your_policy>;Why: From now on, any object that carries the tag passes the policy on to its matching columns.
You should see: The statement succeeds. Running it again with a second STRING policy fails unless you add FORCE.
4.Tag the table:
ALTER TABLE <your_table> SET TAG governance.tags.pii = 'sensitive';Why: A tag set on a table protects all of the table's columns whose type matches the policy.
You should see: No error. The STRING columns are now masked for roles other than ANALYST.
5.Run INFORMATION_SCHEMA.POLICY_REFERENCES with REF_ENTITY_DOMAIN => 'TABLE' for the table.
Why: This confirms the policy arrives through the tag, not through a direct assignment.
You should see: One row per STRING column showing the policy name, TAG_NAME PII and its POLICY_STATUS.
Stuck? Get a nudge
If a column still shows plain text, check whether it has a directly assigned masking policy. A direct policy overrides the tag's policy.
Sources
(15)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“The tag value is always a string, and the maximum number of characters for the tag value is 256.”
↩︎ Tagging objects and tag-based masking - 2.
“the tag is inherited by all of the tables and views in the database or schema”
↩︎ Tagging objects and tag-based masking“You can use the Account Usage TAG_REFERENCES view to identify all tags and their assigned string values.”
↩︎ Finding tags and policy assignments“The POLICY_STATUS column indicates the status of the tag-based policy assignment.”
↩︎ Finding tags and policy assignments - 3.
“the value of the tag is set to the string CONFLICT.”
↩︎ Tagging objects and tag-based masking - 4.
“A tag can have only one masking policy per data type.”
↩︎ Tagging objects and tag-based masking“A tag cannot be dropped if it is assigned to a masking policy.”
↩︎ Tagging objects and tag-based masking“the directly assigned masking policy takes precedence over the masking policy assigned to the tag.”
↩︎ Prediction - 5.
“The masking policy names that were used in a specific query can be found in the Query Profile.”
↩︎ Finding tags and policy assignments“Policy <policy_name> cannot be dropped/replaced as it is associated with one or more entities.”
↩︎ Checkpoint - 6.https://docs.snowflake.com/en/sql-reference/stored-procedures/associate_semantic_category_tagsOfficial docs
“Takes the results of the EXTRACT_SEMANTIC_CATEGORIES function on a table/view and applies the results as tags on the supported columns in the table/view.”
↩︎ Classifying columns with EXTRACT_SEMANTIC_CATEGORIES“Alternate values are not applied.”
↩︎ Exam trap 1 - 7.
“The possible values are IDENTIFIER, QUASI-IDENTIFIER and SENSITIVE.”
↩︎ Classifying columns with EXTRACT_SEMANTIC_CATEGORIES“The function requires a running warehouse.”
↩︎ Classifying columns with EXTRACT_SEMANTIC_CATEGORIES - 8.
“Sets the recommended classification system tags on the columns in the specified object when the classification process is complete.”
↩︎ Classifying columns with EXTRACT_SEMANTIC_CATEGORIES - 9.
“can be used to query the access history of Snowflake objects (e.g. table, view, column) within the last 365 days (1 year).”
↩︎ Auditing reads and writes with ACCESS_HISTORY“Events generated by calls made to the Horizon Iceberg REST Catalog API.”
↩︎ Trust Center scanners and Horizon governance in Snowsight - 10.
“The base_objects_accessed column records the UDF and the table. The direct_objects_accessed column records the view.”
↩︎ Auditing reads and writes with ACCESS_HISTORY“Records in the Account Usage QUERY_HISTORY view do not always get recorded in the ACCESS_HISTORY view.”
↩︎ Exam trap 2 - 11.
“These columns facilitate column lineage.”
↩︎ Auditing reads and writes with ACCESS_HISTORY - 12.
“Switch to a role with the SNOWFLAKE.TRUST_CENTER_ADMIN application role granted to it.”
↩︎ Trust Center scanners and Horizon governance in Snowsight“When a custom schedule is set for an individual scanner, that setting is used instead of its scanner package schedule”
↩︎ Trust Center scanners and Horizon governance in Snowsight - 13.
“This scanner package runs once a day by default, but you can change the schedule.”
↩︎ Trust Center scanners and Horizon governance in Snowsight“Trust Center displays a violation if the account does not have at least one masking policy”
↩︎ Trust Center scanners and Horizon governance in Snowsight“Scanner packages are deactivated by default, except for the Security Essentials scanner package.”
↩︎ Exam trap 3 - 14.
“Snowflake supports enforcing dynamic data masking policies on Apache Iceberg tables”
↩︎ Trust Center scanners and Horizon governance in Snowsight“Snowflake supports enforcing dynamic data masking policies on Apache Iceberg tables that you query from Apache Spark™ through Snowflake Horizon Catalog.”
↩︎ Checkpoint
Also cited
“In the EXPLAIN command result and the Query History page, Snowflake does not show users any row access policy information”
↩︎ Checkpoint