What if you could hand out perfect access keys instantly without worrying about mistakes?
Why System-defined roles (ACCOUNTADMIN, SYSADMIN, etc.) in Snowflake? - Purpose & Use Cases
Imagine you have a big office where many people need different keys to access rooms, files, and machines. If you had to give each person a unique key for every door manually, it would be confusing and slow.
Manually managing who can do what is slow and risky. You might give someone too many keys by mistake or forget to remove keys when they leave. This can cause security problems and lots of extra work.
System-defined roles like ACCOUNTADMIN and SYSADMIN act like master keys with clear, built-in permissions. They make it easy to assign the right access quickly and safely without guessing or mistakes.
GRANT SELECT ON TABLE sales TO USER user_john; GRANT INSERT ON TABLE sales TO USER user_john; GRANT DELETE ON TABLE sales TO USER user_john;
GRANT ROLE SYSADMIN TO USER user_john;
With system-defined roles, you can manage access securely and efficiently, letting people do their jobs without risking your data.
A company uses ACCOUNTADMIN to control overall account settings, while SYSADMIN manages daily database tasks, so everyone has just the right access without confusion.
Manual access control is slow and error-prone.
System-defined roles provide ready-made permission sets.
They simplify secure and efficient access management.
Practice
Solution
Step 1: Understand role privileges
ACCOUNTADMIN is designed to have full control over the Snowflake account, including all objects and user management.Step 2: Compare with other roles
SYSADMIN manages data objects, SECURITYADMIN manages users and roles, and PUBLIC has minimal default privileges.Final Answer:
ACCOUNTADMIN -> Option AQuick Check:
Full account control = ACCOUNTADMIN [OK]
- Confusing SYSADMIN with full control
- Thinking SECURITYADMIN manages data objects
- Assuming PUBLIC has admin privileges
Solution
Step 1: Recall Snowflake role switching syntax
The correct command to switch roles isUSE ROLE <role_name>;.Step 2: Verify options
Only USE ROLE SYSADMIN; matches the correct syntax exactly.Final Answer:
USE ROLE SYSADMIN; -> Option CQuick Check:
Switch role command = USE ROLE [OK]
- Using SET ROLE instead of USE ROLE
- Adding extra words like TO or SWITCH
- Missing semicolon at the end
USE ROLE SECURITYADMIN; CREATE USER test_user PASSWORD='Pass1234'; USE ROLE SYSADMIN; CREATE TABLE test_table(id INT);Which statement is true about the created objects?
Solution
Step 1: Analyze role privileges for user creation
SECURITYADMIN can create users, soCREATE USER test_usersucceeds.Step 2: Analyze role privileges for table creation
SYSADMIN manages data objects, soCREATE TABLE test_tablesucceeds.Final Answer:
Both test_user and test_table are created successfully. -> Option DQuick Check:
SECURITYADMIN creates users, SYSADMIN creates tables [OK]
- Assuming SYSADMIN can create users
- Assuming SECURITYADMIN can create tables
- Confusing role privileges
CREATE USER new_user PASSWORD='abc123'; while using the SYSADMIN role and get an error. What is the most likely cause?Solution
Step 1: Check role privileges for user creation
Only SECURITYADMIN or ACCOUNTADMIN can create users; SYSADMIN lacks this privilege.Step 2: Consider other options
Password complexity or syntax errors would cause different error messages; user existence would be a different error.Final Answer:
SYSADMIN role does not have privileges to create users. -> Option BQuick Check:
User creation requires SECURITYADMIN or ACCOUNTADMIN [OK]
- Blaming password complexity without checking error
- Assuming SYSADMIN can create users
- Ignoring role privilege boundaries
Solution
Step 1: Understand role responsibilities
SECURITYADMIN manages users and roles; SYSADMIN manages data objects; ACCOUNTADMIN has full control.Step 2: Match roles to admin tasks
Assign SECURITYADMIN to the admin handling users, SYSADMIN to the admin handling data, and keep ACCOUNTADMIN yourself for full control.Final Answer:
Assign SECURITYADMIN to user1, SYSADMIN to user2, ACCOUNTADMIN to yourself. -> Option AQuick Check:
Delegate roles by responsibility, keep ACCOUNTADMIN for full control [OK]
- Giving ACCOUNTADMIN to others unnecessarily
- Assigning PUBLIC role for admin tasks
- Mixing up role responsibilities
Ready to prove it?
Pass the test and this pattern moves unknown
