This content originally appeared on DEV Community and was authored by vinicius fagundes
Goal: Get from zero to a working RBAC setup in minutes.
What is RBAC in Snowflake?
RBAC (Role-Based Access Control) determines who can access what in your Snowflake environment.
You assign privileges to roles, then roles to users.
Core RBAC Objects
- USER – Represents a person or service.
- ROLE – Groups privileges together.
- WAREHOUSE – Compute power for running queries.
- DATABASE / SCHEMA – Logical data containers.
- TABLE / VIEW – Where the actual data lives.
Copy & Paste: RBAC Quickstart
sql
-- Create roles
CREATE ROLE analyst;
CREATE ROLE engineer;
-- Create users and assign roles
CREATE USER john PASSWORD='Passw0rd!' DEFAULT_ROLE=analyst;
GRANT ROLE analyst TO USER john;
CREATE USER jane PASSWORD='Passw0rd!' DEFAULT_ROLE=engineer;
GRANT ROLE engineer TO USER jane;
-- Grant roles to SYSADMIN for manageability
GRANT ROLE analyst TO ROLE sysadmin;
GRANT ROLE engineer TO ROLE sysadmin;
This content originally appeared on DEV Community and was authored by vinicius fagundes