What you will be able to do
- Tell apart discretionary, role-based and user-based access control in Snowflake
- Predict who owns an object, who can grant on it, and what happens to its ownership when a role is dropped
- Use future grants to give a role privileges on objects that do not exist yet
- Match the system-defined roles to their responsibilities
- Choose between account roles, database roles and custom roles, and explain how secondary roles widen a session's privileges
Key concept
Default deny on securable objects — Every table, schema, warehouse or other securable object is closed until a grant opens it. In a session, what you can do depends on the privileges held by your active roles. Owners, roles and secondary roles are all different ways of answering one question: which grant lets this request through?
1.Three access control models in one system
Snowflake does not choose a single access control model. It combines three of them, and each one answers a different question. Discretionary access control (DAC) decides who may hand out access: every object has an owner, and that owner decides who else gets privileges on it. Role-based access control (RBAC) decides how those privileges reach people: privileges go to roles, and roles go to users. User-based access control (UBAC) lets a privilege be granted straight to a user, with no role in between.
These models are not alternatives that compete. They describe different stages of one flow. In a typical grant, Role 1 owns a table (DAC). It grants SELECT on the table to Role 2, and Role 2 is granted to two analysts (RBAC). RBAC is the everyday mechanism. UBAC is an extension, and it has a catch: Snowflake considers privileges granted directly to a user only when the session's secondary roles are set to ALL.
| Model | Privileges are held by | What it controls |
|---|---|---|
| DAC | The owning role (OWNERSHIP privilege) | Who may grant access to an object |
| RBAC | Roles, which are granted to users or to other roles | How privileges reach users; the usual way to manage access |
| UBAC | Users directly | Direct grants, considered only when USE SECONDARY ROLES is ALL |
Checkpoint 1 of 9· Match them up
Snowflake combines three access control models. Match each model to the question it answers in a grant flow.
Tap a term, then the definition that fits it.
The three models describe stages of one flow, not competing choices. Ownership (DAC) decides who can grant access, roles (RBAC) carry privileges to users, and direct user grants (UBAC) are an extension that counts only with USE SECONDARY ROLES ALL.
“Access control considers privileges assigned directly to users only when USE SECONDARY ROLE is set to ALL.”Source: docs.snowflake.com
Checkpoint 2 of 9· Exam question
Which statement accurately distinguishes Snowflake's discretionary access control (DAC) model from its role-based access control (RBAC) model?
Correct answer: A — In DAC, the owner of each securable object can grant privileges on that object to other roles, while in RBAC privileges are assigned to roles rather than directly to individual users.
- A. Correct. Snowflake combines DAC, where each object's owning role controls grants on that object, with RBAC, where privileges are assigned to roles and roles are granted to users rather than assigning privileges to users directly.
- B. Incorrect. This swaps the two models: DAC is defined by object ownership controlling grants, not by assigning privileges to roles, and RBAC does use roles rather than leaving decisions solely to owners.
- C. Incorrect. ACCOUNTADMIN is not required for every grant; any role with OWNERSHIP or the MANAGE GRANTS privilege can grant access, and RBAC does not eliminate the owner concept.
- D. Incorrect. Both DAC and RBAC apply across the full securable object hierarchy, from account-level objects like warehouses down to schema-level objects like tables; neither model is scoped to only one level.
Sources1
2.The securable object hierarchy and ownership
Grants follow the container tree of organization, account, database, schema and object, which object hierarchy: organization > account > database > schema > objects teaches. In access control this tree is the securable object hierarchy, and you can grant privileges at every level of it. Containers act as gates. USAGE on a database or schema lets a role run USE on it, so a role with SELECT on a table still needs USAGE on the database and the schema above that table before it can reach it.
Ownership is the DAC half of the model. To own an object is to hold the OWNERSHIP privilege on it. Each object has exactly one owning role, and by default that is the role that created it. In a regular schema the owner holds every privilege on the object and can grant and revoke privileges for other roles. GRANT OWNERSHIP moves ownership to a different role, and the target can be a database role. Everyone who has the owning role shares control of the object.
A managed access schema takes grant decisions away from object owners. In that kind of schema, only the schema owner or a role with MANAGE GRANTS can grant privileges on the objects inside. MANAGE GRANTS lets a role grant and revoke as if it owned the object. Use a managed access schema when a central team, not each object's creator, should decide who sees what.
Dropping a role never leaves objects without an owner. Whatever the dropped role owned now belongs to the role that ran DROP ROLE. The drop is permanent: a dropped role cannot be recovered and must be recreated. There are a few exceptions. You cannot drop your current primary role. You cannot drop a role that owns a shared database until you transfer that ownership with GRANT OWNERSHIP.
Checkpoint 3 of 9· Check yourself
In a regular schema, several data engineers each create tables and grant SELECT on them to whichever roles they like. The security team wants to be the only group that decides who can access objects in that schema. Which change does this?
In a managed access schema, object owners can no longer make grant decisions. Only the schema owner or a role with MANAGE GRANTS can grant privileges on the objects inside. In a regular schema, each object's owner can still grant on that object, even if a different role owns the schema.
“in a managed access schema, object owners lose the ability to make grant decisions”Source: docs.snowflake.com
Checkpoint 4 of 9· Exam question
An engineer runs DROP ROLE FINANCE_ANALYST, a custom role that owned several tables and views, without first reassigning ownership of those objects. What happens to the objects that role owned?
Correct answer: B — Ownership of the objects transfers automatically to the role that dropped FINANCE_ANALYST, since dropping a role requires the dropping role to already hold OWNERSHIP or MANAGE GRANTS on it.
- A. Incorrect. Snowflake does not leave objects permanently ownerless after a role is dropped; ownership is reassigned automatically as part of the drop operation, not left in an unmanageable state.
- B. Correct. When a role is dropped, Snowflake transfers ownership of the objects it owned to the role that issued the DROP ROLE statement, since that role must already hold sufficient privilege over the role being dropped.
- C. Incorrect. DROP ROLE does not require manually reassigning every owned object beforehand; Snowflake handles the ownership transfer automatically rather than blocking the statement.
- D. Incorrect. There is no rule tying ownership transfer to whichever role originally granted the dropped role its OWNERSHIP privilege; the transfer instead goes to the role executing the DROP ROLE command.
3.Future grants for objects that do not exist yet
A grant on existing objects covers only the objects that exist when you run it. If a pipeline keeps creating tables, a reporting role loses access to every table created after the last grant. A future grant fixes this. It sets the privileges that new objects of a given type in a schema receive, and Snowflake applies them each time such an object is created. ON FUTURE handles new objects and ON ALL handles existing ones, so you usually need both.
-- Grant the SELECT privilege on all new (future) tables in a schema to role R1
GRANT SELECT ON FUTURE TABLES IN SCHEMA s1 TO ROLE r1;
-- / Create tables in the schema /
-- Grant the SELECT privilege on all new tables in a schema to role R2
GRANT SELECT ON FUTURE TABLES IN SCHEMA s1 TO ROLE r2;
-- Grant the SELECT privilege on all existing tables in a schema to role R2
GRANT SELECT ON ALL TABLES IN SCHEMA s1 TO ROLE r2;
-- Revoke the SELECT privilege on all new tables in a schema (future grant) from role R1
REVOKE SELECT ON FUTURE TABLES IN SCHEMA s1 FROM ROLE r1;Some workarounds look similar but do not do the same job. A scheduled GRANT ... ON ALL TABLES leaves a gap: a table created between two runs is unreadable until the next run. Making the reporting role owner of the schema does not help either. Each table is still owned by the role that created it, here the ETL role. Granting the ETL role to the reporting role is no better: privileges are inherited by any role above in the hierarchy, so the reporting role would pick up everything the ETL role holds, not just SELECT on these tables.
Checkpoint 5 of 9· Check yourself
Every hour, an ETL role creates new tables in schema s1. The REPORTING role must be able to SELECT from every table in s1, both the ones there now and the ones created later, with no gap. A colleague suggests making REPORTING the owner of schema s1. What is the right assessment?
Owning the schema does not give ownership of the tables inside it. Each table belongs to the role that created it, here the ETL role. A future grant gives new tables their privileges as soon as they are created, and an ON ALL grant covers the tables that already exist, so you need both. A scheduled ON ALL grant leaves a gap between runs.
“Each securable object is owned by a single role, which by default is the role used to create the object.”Source: docs.snowflake.com
Checkpoint 6 of 9· Exam question
A data platform team creates a new schema ANALYTICS.MARTS and expects dozens of tables to be created in it over the coming months by an ETL pipeline running as role ETL_LOADER. They want the REPORTING_RO role to automatically receive SELECT on every table as soon as it is created, without re-running a GRANT statement each time. Which approach satisfies this requirement?
Correct answer: A — Issue a future grant with GRANT SELECT ON FUTURE TABLES IN SCHEMA ANALYTICS.MARTS TO ROLE REPORTING_RO, so Snowflake applies the privilege to tables at creation time.
- A. Correct. Future grants apply a privilege automatically to objects of the specified type that are created later in the schema, so every new table receives SELECT for the reporting role without additional manual grants.
- B. Incorrect. OWNERSHIP on a schema does not grant privileges on objects created by a different role inside it, and OWNERSHIP is a much broader privilege than the read-only access the reporting role needs.
- C. Incorrect. A recurring task could eventually catch up on new tables, but it introduces a delay window and operational overhead that a future grant avoids entirely by applying the privilege at creation time.
- D. Incorrect. Roles cannot be granted to a role via USAGE to inherit table privileges this way; role-to-role inheritance uses GRANT ROLE, and even then privileges on future objects still require a future grant.
4.System-defined roles
Every account comes with a small set of system-defined roles. You cannot drop them, and you cannot revoke the privileges Snowflake gave them. Their job is account management:
- ACCOUNTADMIN contains SYSADMIN and SECURITYADMIN. It is the top-level role, so grant it to only a few, closely controlled users.
- SECURITYADMIN can manage any object grant across the account, and can create, monitor and manage users and roles. It holds MANAGE GRANTS and inherits USERADMIN.
- USERADMIN manages users and roles and nothing else. It holds CREATE USER and CREATE ROLE, and it can manage the users and roles it owns.
- SYSADMIN has the privileges to create warehouses, databases and other objects in the account. When custom roles are arranged in a hierarchy that ends at SYSADMIN, it can also grant privileges on those objects to other roles.
- PUBLIC is a pseudo-role that every user and every role in the account receives automatically. Objects it owns are available to everyone, so it suits cases where explicit access control is not needed.
MANAGE GRANTS does not let SECURITYADMIN create things. It can grant and revoke, but creating an object, such as a database role, still requires that object's own CREATE privilege. For someone who should create users and reset their passwords, but not grant on database objects or manage warehouses, USERADMIN fits most closely.
Checkpoint 7 of 9· Check yourself
A platform team wants every SYSADMIN user to also have SELECT and INSERT on the tables in a finance schema. Which approach follows Snowflake's recommendation for system-defined roles?
Snowflake advises against mixing account-management privileges and object-specific privileges in one role. You grant the extra privileges to a custom role and grant that custom role to the system-defined role. System-defined roles cannot be dropped, and the privileges Snowflake gave them cannot be revoked, so the other two changes are not possible.
“Snowflake recommends granting the additional privileges to a custom role and assigning the custom role to the system-defined role.”Source: docs.snowflake.com
Sources1
5.Functional roles: account, database and custom roles
Functional roles give people the privileges their job needs, and the role type decides how far those privileges can reach. An account role can hold privileges on any object in the account. A database role holds privileges only on objects in its own database, which suits access such as read access to the SALES database that should never spread further. Custom roles are the ones you create. Any user with a role that has the right privileges can create one.
Database roles have a limit that catches people out: you cannot activate one directly in a session. Suppose an analyst has the ANALYST account role and needs the SELECT privileges held by DB_SALES.READ_ROLE. First grant the database role to an account role the analyst can use, such as ANALYST. Then the analyst activates that account role.
Granting roles to roles builds a hierarchy, and each role inherits the privileges of every role below it. Inheritance happens only inside the hierarchy. A role that owns another role does not get that role's privileges, because ownership of a role is not a grant of it.
Checkpoint 8 of 9· Match them up
An analyst needs the SELECT privileges held by DB_SALES.READ_ROLE. Match each role, or each relationship between roles, to how it behaves.
Tap a term, then the definition that fits it.
Database roles are limited to one database and cannot be activated with USE ROLE, so you grant them to an account role and the user activates that account role. Privileges are inherited only through grants in a role hierarchy. Owning a role does not pass on its privileges.
“Note that database roles cannot be activated directly in a session. Grant database roles to account roles, which can be activated in a session.”Source: docs.snowflake.com
Sources1
6.Primary and secondary roles in a session
A user can have many roles, but by default one active role decides what the session can do. Secondary roles add the privileges of more roles on top. USE SECONDARY ROLES ALL activates every role granted to the user besides the primary role. Snowflake works out this set again for every statement, so a role granted halfway through a session counts from the next statement onward. USE SECONDARY ROLES NONE turns them off, and only the primary role authorizes actions. You can also name specific roles, provided each one has been granted to you.
Two rules decide what secondary roles cannot do. First, permission to run CREATE <object> comes only from the primary role, so the primary role owns every new object. Second, privileges granted directly to a user (UBAC) count only when secondary roles are set to ALL.
Checkpoint 9 of 9· Check yourself
SELECT on a reporting view was granted directly to user JDOE, not to any role. JDOE's session runs USE SECONDARY ROLES ANALYST, BI_READER, both of which are roles granted to JDOE, and the query on the view is denied. What change lets the direct grant count?
Direct grants to a user (UBAC) count only when the session's secondary roles are set to ALL. Naming specific roles or turning secondary roles off with NONE leaves the direct grant out.
“Access control considers privileges assigned directly to users only when USE SECONDARY ROLE is set to ALL.”Source: docs.snowflake.com
Sources5
Sources
(5)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“Discretionary Access Control (DAC): Each object has an owner, who can in turn grant access to that object.”
↩︎ Three access control models in one system“Role-based Access Control (RBAC): Access privileges are assigned to roles, which are in turn assigned to users.”
↩︎ Three access control models in one system“Access control considers privileges assigned directly to users only when USE SECONDARY ROLE is set to ALL.”
↩︎ Three access control models in one system“Usually, you use RBAC to manage access to securable objects in Snowflake.”
↩︎ Three access control models in one system“Each securable object is owned by a single role, which by default is the role used to create the object.”
↩︎ The securable object hierarchy and ownership“The GRANT OWNERSHIP command lets you transfer the ownership of an object from one role to another role, including to database roles.”
↩︎ The securable object hierarchy and ownership“However, in a managed access schema, object owners lose the ability to make grant decisions.”
↩︎ The securable object hierarchy and ownership“The privileges associated with a role are inherited by any roles above that role in the hierarchy.”
↩︎ Future grants for objects that do not exist yet“System-defined roles cannot be dropped. In addition, the privileges granted to these roles by Snowflake cannot be revoked.”
↩︎ System-defined roles“Role that encapsulates the SYSADMIN and SECURITYADMIN system-defined roles.”
↩︎ System-defined roles“It is the top-level role in the system and should be granted only to a limited/controlled number of users in your account.”
↩︎ System-defined roles“Role that can manage any object grant globally, as well as create, monitor, and manage users and roles.”
↩︎ System-defined roles“It does not give the SECURITYADMIN the ability to perform other actions such as creating objects.”
↩︎ System-defined roles“Is granted the CREATE USER and CREATE ROLE security privileges.”
↩︎ System-defined roles“Role that has privileges to create warehouses and databases (and other objects) in an account.”
↩︎ System-defined roles“Pseudo-role that is automatically granted to every user and every role in your account.”
↩︎ System-defined roles“Snowflake recommends granting the additional privileges to a custom role and assigning the custom role to the system-defined role.”
↩︎ System-defined roles“To permit SQL actions on any object in your account, grant privileges on the object to an account role.”
↩︎ Functional roles: account, database and custom roles“grant privileges on the object to a database role in the same database.”
↩︎ Functional roles: account, database and custom roles“Users who have been granted a role with the necessary privileges can create custom roles to meet specific business and security needs.”
↩︎ Functional roles: account, database and custom roles“A role owner (the role that has the OWNERSHIP privilege on the role) does not inherit the privileges of the owned role.”
↩︎ Functional roles: account, database and custom roles“Securable object: An entity to which access can be granted. Unless allowed by a grant, access is denied.”
↩︎ Key concept“Note that database roles cannot be activated directly in a session.”
↩︎ Exam trap 2“in a managed access schema, object owners lose the ability to make grant decisions”
↩︎ Checkpoint“Each securable object is owned by a single role, which by default is the role used to create the object.”
↩︎ Checkpoint“Note that database roles cannot be activated directly in a session. Grant database roles to account roles, which can be activated in a session.”
↩︎ Checkpoint“Access control considers privileges assigned directly to users only when USE SECONDARY ROLE is set to ALL.”
↩︎ Checkpoint - 2.
“Grants the ability to execute a USE <object> command on the object.”
↩︎ The securable object hierarchy and ownership“Grants the ability to grant or revoke privileges on any object as if the invoking role were the owner of the object.”
↩︎ The securable object hierarchy and ownership“OWNERSHIP is a special privilege on an object that is automatically granted to the role that created the object”
↩︎ Future grants for objects that do not exist yet - 3.
“Dropped roles cannot be recovered; they must be recreated.”
↩︎ The securable object hierarchy and ownership“A role cannot be dropped if it has the OWNERSHIP privilege on a shared database.”
↩︎ The securable object hierarchy and ownership“Ownership of any objects owned by the dropped role is transferred to the role that executes the DROP ROLE command.”
↩︎ Exam trap 1“Ownership of any objects owned by the dropped role is transferred to the role that executes the DROP ROLE command.”
↩︎ Prediction - 4.
“As new objects are created, the defined privileges are automatically granted to a role, simplifying grant management.”
↩︎ Future grants for objects that do not exist yet - 5.
“All roles that have been granted to the user in addition to the current active primary role.”
↩︎ Primary and secondary roles in a session“Note that the set of roles is reevaluated when each SQL statement executes.”
↩︎ Primary and secondary roles in a session“Disables secondary roles. The authorization for all SQL actions is provided via the primary role.”
↩︎ Primary and secondary roles in a session“Note that authorization to execute CREATE <object> statements to create objects is provided by the primary role.”
↩︎ Exam trap 3