Using container-level MANAGE GRANTS¶
This topic describes how to grant, delegate, revoke, and audit
container-level MANAGE GRANTS.
Get started¶
Container-level MANAGE GRANTS lets you delegate grant administration on a single database or schema to a role,
without granting that role access across the entire account. A typical workflow is as follows:
- Identify the container and the delegated role. Decide which database or schema the role should administer, and choose the narrowest practical scope of authority.
- Grant
MANAGE GRANTSon the container. UseSECURITYADMIN(or another role that already holds account-levelMANAGE GRANTS WITH GRANT OPTION) to grant the privilege to the delegated role. - Optionally allow further delegation. Include
WITH GRANT OPTIONif the delegated role should be able to grantMANAGE GRANTSon lower-level containers (for example, schemas inside its database). - Audit periodically. Review who holds
MANAGE GRANTSon each container, and revoke when no longer required.
Syntax¶
RESTRICT (default) fails the revocation if any dependent MANAGE GRANTS privileges exist. CASCADE also revokes
those dependent MANAGE GRANTS privileges.
How to obtain MANAGE GRANTS on a container¶
A role obtains MANAGE GRANTS on a database or schema in one of two ways:
-
From an account administrator holding
MANAGE GRANTS ON ACCOUNT WITH GRANT OPTION: -
From an existing role that holds container-level
MANAGE GRANTSon the same or a higher container, withWITH GRANT OPTION:
The WITH GRANT OPTION clause is required to delegate MANAGE GRANTS further.
Examples¶
Delegate grant management for a database¶
Outcome: sales_admin now holds MANAGE GRANTS on sales_db and can also delegate MANAGE GRANTS on schemas
inside it.
Skip-level delegation¶
Outcome: us_west_lead becomes the role that holds MANAGE GRANTS for sales_db.us_west. No intermediate grant
on sales_db is required.
Revoke MANAGE GRANTS from a role with cascade¶
Outcome: Dependent MANAGE GRANTS granted by sales_admin (for example, MANAGE GRANTS on database sales_db
or on schemas inside sales_db) are revoked. Regular grants, and non-MANAGE GRANTS inherited grants created by
sales_admin, are preserved.
Audit container-level MANAGE GRANTS¶
Snowflake supports the following approaches to facilitate container-level MANAGE GRANTS auditing.
- Use
SHOW GRANTS ON DATABASE <name>andSHOW GRANTS ON SCHEMA <name>to enumerate every grant inside a delegated container, including grants made by the role that holdsMANAGE GRANTS. - Use the
GRANTS_TO_ROLESview inACCOUNT_USAGEto reconstruct the history ofMANAGE GRANTSdelegations, including revoked grants (which appear with a non-nullDELETED_ONvalue).
Find all roles that hold MANAGE GRANTS in the account:
Find all roles that hold MANAGE GRANTS for a specific database:
Find all containers where a specific role holds MANAGE GRANTS: