RBAC Explained

Snowflake · Security & Governance

Theory

Snowflake combines role-based access control (RBAC) with discretionary access control (DAC). In RBAC, privileges such as SELECT on a table or USAGE on a warehouse are granted to roles, and roles are granted to users or to other roles. In DAC, every object has an owner role, and the owner can grant access to it. A user works under one active primary role at a time, and also gets privileges of roles below it in the hierarchy.

System roles form the top of the hierarchy: ACCOUNTADMIN contains SECURITYADMIN and SYSADMIN, SECURITYADMIN contains USERADMIN, and PUBLIC is granted to everyone. Best practice is to grant custom roles such as data_analyst to SYSADMIN, so administrators can manage the objects they create.

Why we use it

Granting privileges to roles instead of individual users makes access easy to audit and change. When someone joins or leaves a team you grant or revoke one role, instead of dozens of object grants.

When to use it

Use functional roles (analyst, engineer) that inherit access roles (read on a schema, write on a schema). Keep ACCOUNTADMIN for very few people with MFA, and use SYSADMIN or custom roles for daily work.

Roles, Not Users, Hold Privileges

Access is never granted straight to a user — privileges like SELECT on a table are granted to a role, and roles are granted to users, often through an inheritance hierarchy.

Built-In System Roles

SYSADMIN, SECURITYADMIN, and ACCOUNTADMIN cover common admin needs out of the box, each scoped to a different kind of administrative task.

Designing With Least Privilege

The model is built around giving each role only what it needs — a well-designed role hierarchy limits blast radius if any one set of credentials is compromised.

The Role Hierarchy

ACCOUNTADMIN ← top level (use sparingly) │ ┌─────────┼──────────┐ ▼ ▼ ▼ SYSADMIN SECURITYADMIN USERADMIN │ ▼ Custom Roles (data_engineer, data_analyst, ...) │ ▼ PUBLIC ← everyone has this role

How it works

  1. User runs a query
  2. Session has a primary role (and any secondary roles)
  3. Collect privileges from those roles and every role they inherit
  4. Is the needed privilege among them? Yes: Allow the action. No: Return an insufficient privileges error.
  5. Grant the right role, not a direct object privilege, to fix access

Example

CREATE ROLE data_engineer;
CREATE ROLE data_analyst;
CREATE ROLE data_scientist;
CREATE ROLE bi_viewer;

GRANT ROLE data_engineer TO ROLE sysadmin;
GRANT ROLE data_analyst TO ROLE sysadmin;
GRANT ROLE data_scientist TO ROLE data_analyst;
GRANT ROLE bi_viewer TO ROLE data_analyst;

GRANT USAGE ON DATABASE practice_db TO ROLE data_analyst;
GRANT SELECT ON ALL TABLES IN SCHEMA practice_db.learn TO ROLE data_analyst;
GRANT SELECT ON FUTURE TABLES IN SCHEMA practice_db.learn TO ROLE data_analyst;
GRANT USAGE ON WAREHOUSE analytics_wh TO ROLE data_analyst;

GRANT ROLE data_analyst TO USER john_smith;
SHOW GRANTS TO ROLE data_analyst;

Key points

Snowflake topics

Snowflake Fundamentals

Warehouses & Performance

Staging & SnowSQL

Tables & Data Handling

Cloud Integrations

Storage & Optimization

Security & Governance

Views, Pipelines & Automation

Data Types & SQL Fundamentals

Semi-Structured Data Deep Dive

Advanced Features

Data Sharing & Collaboration

Cost Management & Monitoring

Databases, Schemas & Objects

Performance Deep Dive

Advanced Security & Governance

Stored Procedures & UDFs

Ecosystem & Integrations

SnowPro Certification Prep

T
Tech Town
Log InSign Up Free
Home SQL Python DSA Power BI Snowflake Databricks Spark Gen AI Practice Problems Contest Blog

Mastering Snowflake

The modern data cloud, from architecture to SnowPro certification. Click any topic in the sidebar to open it right here.

{{ sectionCount }}
Sections
{{ topicCount }}
Topics
Free
Forever
Hands-on practice Practice Snowflake SQL Sharpen the SQL you use in Snowflake: 150 query problems in a live editor with instant checking. Start practising →
Section {{ sec.num }}

{{ sec.label }}

Snowflake  /  {{ current.sectionLabel }}  /  {{ current.name }}

{{ current.name }}

Theory

{{ current.def }}

Why we use it

{{ rich.why }}

When to use it

{{ rich.when }}

{{ sec.h }}

{{ sec.body }}

{{ sec.body }}

Diagram

{{ rich.dg.caption }}

{{ tb.title }}
{{ c.v }}
{{ rich.dg.op }}
➜
{{ rich.dg.output.title }}
{{ c.v }}
{{ nd.label }}
{{ nd.sub }}
{{ nd.label }}
{{ nd.sub }}
{{ rich.dg.left.title }}
{{ it }}
{{ rich.dg.right.title }}
{{ it }}
On screen — where to click

{{ rich.ui.title }}

{{ u.text }}
  1. {{ st.n }}{{ st.text }}
{{ rich.ui.title }}
{{ u.text }}
Flowchart — how it works
{{ nd.text }}
{{ nd.text }}
◇ {{ nd.text }}
Yes → {{ nd.yes }}
No → {{ nd.no }}
Syntax
{{ current.syntax }}
Example
{{ current.example }}
Want to run this yourself? Unlike the SQL and Python courses, Snowflake needs a real account — there's no in-browser engine for it. Click Copy above, then paste it into a free Snowflake trial (30 days, no card required) and run it in Snowsight.
Key Points — click to check off as you learn
  • {{ pt.mark }} {{ pt.text }}

Share this topic