Snowflake CREATE USER: Granting User Access
This command is used to add a new user to Snowflake, setting up their login credentials and defaults for their working environment.
Basic Syntax
_10CREATE USER [IF NOT EXISTS] <name>_10 PASSWORD = '<string>'_10 DEFAULT_WAREHOUSE = '<warehouse_name>'_10 MUST_CHANGE_PASSWORD = TRUE | FALSE_10 ..
Best Practices
- Secure Passwords: Always use complex passwords and enforce regular changes.
- Role Management: Assign roles carefully to control access and permissions.
- Regular Audits: Use DESCRIBE USER and SHOW USERS to review and audit user settings and roles.
Examples
Create a User with default Warehouse selected
Snowflake SQL Query
_10CREATE USER john_doe_10PASSWORD = 'Secure*123'_10DEFAULT_WAREHOUSE = 'analytics_wh'_10MUST_CHANGE_PASSWORD = TRUE;
Explanation
This creates a user named john_doe
with a specified password, assigns a default warehouse, and requires the password to be changed upon the first login.
Related Commands
ALTER USER
Modifies existing user properties.
_10ALTER USER john_doe SET DEFAULT_ROLE = 'analyst';
DROP USER
Removes a user from the system.
_10DROP USER john_doe;
DESCRIBE USER
Shows detailed information about the user's settings.
_10DESCRIBE USER john_doe;
SHOW USERS
SHOW USERS;
_10SHOW USERS;