Medium severitycredentials
Power BI Refresh Error:
Masking Policy Error
What does this error mean?
A Snowflake dynamic data masking policy failed to apply or caused an error during query execution. Queries that reference columns with masking policies may fail or return unexpected results.
Common causes
- 1The masking policy function references a context function (e.g., CURRENT_ROLE()) but the result is null or unexpected for the executing role
- 2A masking policy was applied to a column whose data type does not match the policy's return type
- 3The masking policy references a secondary role or table that was dropped or renamed
- 4Applying a new masking policy to a Dynamic Table base column triggered a reinitialization that failed
- 5The service account running the query is not in the list of roles that see unmasked data, causing unexpected nulls or tokenized values downstream
How to fix it
- 1Test the masking policy in isolation: `SELECT SYSTEM$POLICY_CONTEXT()` to see the current policy context for your role.
- 2Verify the policy return type matches the column data type: `DESCRIBE MASKING POLICY <policy_name>`.
- 3Check whether the policy references any external tables or secondary roles: `SHOW GRANTS ON MASKING POLICY <policy_name>`.
- 4For Dynamic Table issues: if a base table masking policy changed, recreate the Dynamic Table.
- 5For service accounts: add the service account role to the unmasked role list in the policy body or create a separate policy that returns unmasked values for the service account role.