Access Control: RBAC, DAC, and Roles
SnowPro Core · Lesson 10 of 27 · 1:07:32
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the SnowPro Core Certification exam (COF-C03). In this lesson: discretionary and role-based access control, the system-defined roles, custom and database roles, and secondary roles. Follows Foxglove Apparel, a fictional online clothing retailer. Includes three original practice questions.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Who gets access to what
Foxglove's analysts need to read sales data, its engineers build pipelines, and only a few people should manage the whole account. A new analyst asks for access, and a colleague suggests granting privileges straight to that user. In Snowflake, the answer is almost always a role, placed in the right hierarchy.
DAC and RBAC
Snowflake combines two access models. With discretionary access control, every object has an owner, which is the role that holds the OWNERSHIP privilege, and the owner can grant access to the object. With role-based access control, privileges are granted to roles, and roles are granted to users, or to other roles. A securable object is anything that access can be granted on, and unless a grant allows it, access is denied.
Securable objects and grants
Securable objects sit in a hierarchy of containers: the organization, the account, databases, schemas, and the tables, views, and stages inside schemas. To query a table, a role needs USAGE on its database and on its schema, plus SELECT on the table itself. Future grants give privileges on objects of a given type that will be created later, in a database or a schema. And in a managed access schema, object owners can no longer grant access: only the schema owner, or a role with MANAGE GRANTS, decides.
System-defined roles
Every account comes with system-defined roles. ACCOUNTADMIN is the top role: it contains SECURITYADMIN and SYSADMIN, and it should go to a few people, at least two, all using M F A. SECURITYADMIN holds MANAGE GRANTS, to change any grant, and it inherits USERADMIN, which creates users and roles. SYSADMIN creates warehouses and databases, and PUBLIC is granted automatically to every user and every role.
Role hierarchy best practices
At the organization level, GLOBALORGADMIN manages the accounts from the organization account, and it replaces ORGADMIN, which is being phased out. Inside an account, Snowflake recommends granting your top custom roles to SYSADMIN, so that system administrators can manage the objects those roles own. ACCOUNTADMIN should be nobody's default role, and it should not be used to create everyday objects. And a new role is granted to no user and to no other role, until you grant it.
Custom and database roles
Snowflake recommends two layers of custom roles. Access roles hold the privileges on objects, such as reading a schema, and functional roles, like analyst or engineer, receive the access roles they need. Database roles belong to one database, and they cannot be activated in a session, so you grant them to account roles. USERADMIN, or any role with CREATE ROLE, creates custom account roles, and the owner of a database creates its database roles.
Primary and secondary roles
In a session, one role is the primary role, and other roles granted to the user can be active as secondary roles. USE SECONDARY ROLES ALL activates every other role granted to the user, and NONE turns them off. The privileges of all active roles combine, but the authority to run CREATE statements comes only from the primary role. And a user's default secondary roles can be set to all, so that they are active from the start of each session.
Recap
Let's recap. Every object has an owning role, and privileges go to roles, which go to users or to other roles. Querying a table needs USAGE on its database and schema, and SELECT on the table, while future grants cover objects created later. ACCOUNTADMIN contains SECURITYADMIN and SYSADMIN, USERADMIN creates users and roles, and PUBLIC goes to everyone. Access roles feed functional roles, which roll up to SYSADMIN, and database roles stay inside one database. And secondary roles add privileges, but CREATE statements rely on the primary role.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
Foxglove wants its analyst role to get SELECT on every new table that engineers create in the SALES schema, without anyone running a grant each time. What should the administrator set up?
- A future grant on tables in SALES
- OWNERSHIP of SALES to the analyst role
- SELECT on all the existing tables in SALES
- SALES as a managed access schema
Show the answer
A future grant on tables in SALES
A future grant gives SELECT on every table created later in that schema. “OWNERSHIP of SALES to the analyst role” would hand the analysts full control of the schema, far more than reading. “SELECT on all the existing tables in SALES” only covers the tables that exist today. And “SALES as a managed access schema” is about who may grant access, and it does not grant anything by itself.
Foxglove’s administrators built a tree of custom roles for the finance team, but its top role was never granted to SYSADMIN. What is the result?
- The finance roles cannot be granted to users
- SECURITYADMIN cannot change finance grants
- SYSADMIN cannot manage the finance objects
- The finance objects become visible to PUBLIC
Show the answer
SYSADMIN cannot manage the finance objects
Without that grant, system administrators cannot manage the objects that the finance roles own. “The finance roles cannot be granted to users” is wrong, because a custom role can still be granted to users. “SECURITYADMIN cannot change finance grants” is wrong, since SECURITYADMIN keeps MANAGE GRANTS on every object. And “The finance objects become visible to PUBLIC” is wrong, because PUBLIC only gets what is granted to it.
An engineer’s primary role is ANALYST, and all secondary roles are active, including ENGINEER, which has CREATE TABLE on the schema. The engineer runs CREATE TABLE, and it fails. Why?
- Secondary roles only cover SELECT statements
- CREATE privileges come from the primary role only
- Creating a table requires ACCOUNTADMIN
- ENGINEER also needs MANAGE GRANTS
Show the answer
CREATE privileges come from the primary role only
The authority to run CREATE statements comes only from the primary role, so the engineer must switch to the ENGINEER role. “Secondary roles only cover SELECT statements” is wrong, since secondary roles count for other actions too, such as inserts. “Creating a table requires ACCOUNTADMIN” is wrong, because the CREATE TABLE privilege on the schema is enough. And “ENGINEER also needs MANAGE GRANTS” is wrong, since MANAGE GRANTS is for granting privileges, not for creating tables.