User Roles, Permissions, RBAC in Snowflake
A simple, story-driven guide to understanding Snowflake access control
Imagine Snowflake as a giant digital office building.
Inside the building:
- Users = People working in the office
- Roles = Keys to the rooms
- Permissions = What each key unlocks
- RBAC (Role-Based Access Control) = The security system that manages all keys
Snowflake doesnβt give permissions directly to people.
Instead, permissions are given to roles, and users are assigned roles.
This keeps the building safe, clean, and easy to manage.
Letβs walk through Snowflake RBAC in the simplest, clearest way.
π 1. What Is RBAC in Snowflake?β
RBAC = Role-Based Access Control
A security model where:
Users β Assigned Roles β Roles Granted Permissions
You never grant privileges to users directly.
Why?β
Because:
- Users come and go
- Roles stay forever
- Permissions remain organized
- Audits remain clean
Snowflakeβs RBAC model is widely considered one of the cleanest in the industry.
π₯ 2. Important Terms You Must Knowβ
Usersβ
People or services connecting to Snowflake.
Rolesβ
The main objects that hold permissions.
Examples:
SYSADMINUSERADMINSECURITYADMINDATA_ENGINEERBI_ANALYST
Grantsβ
Permissions attached to roles.
Examples:
- SELECT
- INSERT
- CREATE TABLE
- USAGE
- OPERATE
Role Hierarchyβ
Roles can be granted to other roles (like a family tree).
π 3. The Three Most Important Built-In Rolesβ
π¦ 1. SYSADMINβ
Builds databases, schemas, and tables.
Owns most data objects.
Used by:
- Data engineers
- Data architects
π© 2. SECURITYADMINβ
Manages:
- Roles
- Grants
- Permissions
Used by:
- Security teams
- Administrators
π§ 3. USERADMINβ
Manages:
- Creating users
- Assigning roles
Used by:
- HR IT team
- Platform engineers
These roles are separate so that no single person has all power β governance done right.
π 4. Custom Roles β The Real Power of Snowflakeβ
Built-in roles are strong, but real companies use custom roles.
Examples:
ROLE_DATA_ENGINEERROLE_ANALYSTROLE_MARKETING_USERROLE_ETL_PIPELINEROLE_READONLY
You create custom roles to build a clean permission structure.
Example: Create a custom roleβ
CREATE ROLE ROLE_ANALYST;
GRANT ROLE ROLE_ANALYST TO USER JOHN;
π‘ 5. How Permissions Work (Simple Explanation)β
Think of permissions like keys:
Database-level keysβ
- USAGE
- CREATE SCHEMA
Schema-level keysβ
- USAGE
- CREATE TABLE
- CREATE VIEW
Table-level keysβ
- SELECT
- INSERT
- UPDATE
- DELETE
- TRUNCATE
Example Grantβ
GRANT SELECT ON TABLE SALES_DB.ANALYTICS.SALES TO ROLE ROLE_ANALYST;
Roles collect keys. Users collect roles. This is RBAC in action.
π§± 6. Real Company Example: A Clean RBAC Structureβ
Letβs imagine a mid-size company with 3 teams:
β Team 1: Data Engineeringβ
Needs:
- CREATE TABLE
- INSERT/UPDATE
- Pipeline execution
- Warehouse usage
β Team 2: BI/Analyticsβ
Needs:
- SELECT access
- Read-only dashboards
β Team 3: Executivesβ
Needs:
- Limited SELECT on curated data
- No raw data access
Now letβs structure it using RBAC:
π§© Step-by-Step Real RBAC Setupβ
π£ Step 1 β Create Custom Rolesβ
CREATE ROLE ROLE_DATA_ENGINEER;
CREATE ROLE ROLE_ANALYST;
CREATE ROLE ROLE_EXECUTIVE;
CREATE ROLE ROLE_READONLY;
π£ Step 2 β Assign Users to Rolesβ
GRANT ROLE ROLE_ANALYST TO USER ANALYST_1;
GRANT ROLE ROLE_DATA_ENGINEER TO USER DE_1;
GRANT ROLE ROLE_EXECUTIVE TO USER CEO;
π£ Step 3 β Grant Schema & Table Permissionsβ
Data Engineers (full control on RAW & STAGE)β
GRANT USAGE ON DATABASE RAW_DB TO ROLE ROLE_DATA_ENGINEER;
GRANT USAGE ON SCHEMA RAW_DB.RAW TO ROLE ROLE_DATA_ENGINEER;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA RAW_DB.RAW TO ROLE ROLE_DATA_ENGINEER;
Analysts (read curated only)β
GRANT USAGE ON DATABASE PROD_DB TO ROLE ROLE_ANALYST;
GRANT USAGE ON SCHEMA PROD_DB.ANALYTICS TO ROLE ROLE_ANALYST;
GRANT SELECT ON ALL TABLES IN SCHEMA PROD_DB.ANALYTICS TO ROLE ROLE_ANALYST;
Executives (read from reporting schema only)β
GRANT SELECT ON ALL TABLES IN SCHEMA PROD_DB.REPORTING TO ROLE ROLE_EXECUTIVE;
π£ Step 4 β Assign Warehouses to Rolesβ
Roles need warehouse access to run queries.
GRANT USAGE ON WAREHOUSE WH_ANALYTICS TO ROLE ROLE_ANALYST;
GRANT USAGE ON WAREHOUSE WH_ETL TO ROLE ROLE_DATA_ENGINEER;
π° 7. Role Hierarchy β Building the Security Pyramidβ
Most companies create a simple pyramid like this:
ORGADMIN
β
βββ ACCOUNTADMIN
β
βββ SECURITYADMIN
β βββ USERADMIN
β
βββ SYSADMIN
βββ <Custom Department Roles>
βββ ROLE_DATA_ENGINEER
βββ ROLE_ANALYST
βββ ROLE_MARKETING
βββ ROLE_EXECUTIVE
Meaning:
- Admins manage roles
- Sysadmins own objects
- Teams get custom roles
Super clean. Super scalable.
π§ 8. Best Practicesβ
β Use custom roles for all business teamsβ
Do not assign SYSADMIN to everyone.
β Never grant privileges directly to a userβ
Always use roles.
β Use role hierarchy to simplify managementβ
Parent roles β child roles β users.
β Separate βreadβ and βwriteβ permissionsβ
Avoid data accidents.
β Create dedicated service roles for pipelinesβ
Avoid using human roles for automation.
β Periodically audit roles & unused privilegesβ
Security stays tight.
π― One-Sentence Summaryβ
Snowflake RBAC gives permissions to rolesβnot usersβmaking access control clean, scalable, and secure across your entire organization.
π Next Topic
π SQL Basics in Snowflake β SELECT, FILTER, GROUP BY