RBAC - Database roles and orginization
Goal of this tutorial is to show examples of both column level masking and row level masking in Snowflake.
Video
Video still in development.
Requirements
- Snowflake account, you can use a free trial. We also assume no complex security needs.
- Snowflake account needs to Enterprise Edition or higher.
Sample data
Please Update the "YOUR_USER_EMAIL" section for row level masking to work.
| number of rows inserted |
|---|
| 3 |
Column Level Masking
We want only the ENGINEER or ACCOUNTADMIN role to see the full email addresses. Everyone else will see asterisks.
| status |
|---|
| Statement executed successfully. |
Lets see the results. Try changing your role in the sheet by using "use role sysadmin".
| ORDER_ID | EMPLOYEE_NAME | EMPLOYEE_EMAIL | SALES_REGION | SALE_AMOUNT |
|---|---|---|---|---|
| 1001 | Jane Doe | *** | West | 1500 |
| 1002 | Mike Smith | *** | East | 2200.5 |
| 1003 | Sara Lee | *** | Central | 950 |
| 1004 | Admin User | *** | West | 3100.25 |
Row Level Masking
We want users to only see rows belonging to their assigned region based on the user_region_map.
| status |
|---|
| Statement executed successfully. |
Lets see the results. Try changing your role in the sheet by using "use role sysadmin"