In this post we are going to cover users in Snowflake.
A user in Snowflake is two names and forty-four properties. The two names are the one you look the user up by and the one the user signs in with, and they are not interchangeable. Most of the properties you will never set.
We will start with the smallest user it is possible to make, read every property it has, and build up from there. Along the way Snowflake will let us point a user at a role that does not exist and tell us the statement succeeded.
No passwords are set anywhere in this post. Every user below is created disabled and dropped again at the end, so none of them can sign in.
Every query below was run on a real Snowflake account, and every result you see is the output it gave back, refusals included.
Episode 163 of the Snowflake SQL: Zero to Hero series on TechBrothersIT.
- Let's start by reading the user that is already there
- Now let's make the smallest user we can
- Now let's describe it and count what comes back
- Now a user whose login name is not its name
- And what does a rename move?
- Now let's point a user at things that are not there
- Now let's set some properties and unset them again
- What happens when a name clashes?
- A user has parameters as well as properties
- One last thing: authentication policies
Let's start by reading the user that is already there
Before making anything, it is worth reading the user we are signed in as, so we know what state we have to leave it in.
-- Setup for this post.
-- No passwords anywhere in this episode. Every user below is created
-- DISABLED and dropped again at the end, so none of them can sign in.
USE ROLE ACCOUNTADMIN;
USE DATABASE DEMO_DB;
-- A role for one of them to point a DEFAULT_ROLE at.
CREATE OR REPLACE ROLE RDEF_T163
COMMENT = 'episode 163 - a role to point a DEFAULT_ROLE at';SHOW USERS;
DESCRIBE USER YOUR_USER;Those two grids are not on this page. Every row of them carries the account's own user name, its login name and its email address, and the builder here cannot leave a column out of a grid, so the whole grid is left out instead. Run them on your own account and read your own.
Everything from here on is a user this post created and dropped again.
Now let's make the smallest user we can
A name, a comment, and disabled. That is all.
CREATE OR REPLACE USER U_T163
DISABLED = TRUE
COMMENT = 'episode 163 - the smallest user, disabled, no password';| status |
|---|
| User U_T163 successfully created. |
And here it is in the catalogue.
SELECT "name", "login_name", "display_name", "disabled", "default_role",
"default_warehouse", "has_password", "has_rsa_public_key", "comment"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));| name | login_name | display_name | disabled | default_role | default_warehouse | has_password | has_rsa_public_key | comment |
|---|---|---|---|---|---|---|---|---|
| U_T163 | U_T163 | U_T163 | true | NULL | NULL | false | false | episode 163 - the smallest user, disabled, no password |
Disabled true, no default role, no default warehouse, no password, and the login name has been filled in for us from the name.
The grey NULL cells in that grid are real SQL nulls, because that grid came from SHOW USERS. Keep that in mind for the next section, where the same information is written a different way.
Now let's describe it and count what comes back
DESCRIBE USER gives one row per property, with the value and the default side by side.
DESCRIBE USER U_T163;| property | value | default | description |
|---|---|---|---|
| NAME | U_T163 | null | Name |
| COMMENT | episode 163 - the smallest user, disabled, no password | null | user comment associated to an object in the dictionary |
| DISPLAY_NAME | U_T163 | null | Display name of the associated object |
| TYPE | PERSON | null | Type of the account, application package, data exchange, data exchange listing, replication group, secret, network rule, user, or cortex extension. |
| LOGIN_NAME | U_T163 | null | Login name of the user |
| FIRST_NAME | null | null | First name of the user |
| MIDDLE_NAME | null | null | Middle name of the user |
| LAST_NAME | null | null | Last name of the user |
| null | null | Email address of the user | |
| PASSWORD | null | null | Password of the user |
| MUST_CHANGE_PASSWORD | false | false | User must change the password |
| DISABLED | true | false | Whether the entity is disabled |
| SNOWFLAKE_LOCK | false | false | Whether the user, account, or organization is locked by Snowflake |
| SNOWFLAKE_SUPPORT | false | false | Snowflake Support is allowed to use the user or account |
| DAYS_TO_EXPIRY | null | null | User record will be treated as expired after specified number of days |
| MINS_TO_UNLOCK | null | null | Temporary lock on the user will be removed after specified number of minutes |
| DEFAULT_WAREHOUSE | null | null | Default warehouse |
| DEFAULT_NAMESPACE | null | null | Default database namespace prefix for this user |
| DEFAULT_ROLE | null | null | Primary principal of user session will be set to this role |
| DEFAULT_SECONDARY_ROLES | ["ALL"] | [ALL] | The secondary roles will be set to all roles provided here. |
| EXT_AUTHN_DUO | false | false | Whether Duo Security is enabled as second factor authentication |
| EXT_AUTHN_UID | null | null | External authentication ID of the user |
| DEFAULT_MFA_METHOD | null | null | Default MFA method for the user |
| HAS_MFA | false | false | Whether the user is enrolled in multi-factor authentication |
| HAS_PAT | false | false | Whether the user has a programmatic access token |
| HAS_WORKLOAD_IDENTITY | false | false | Whether the user has workload identity defined |
| HAS_KEYPAIR | false | false | Whether the user has a key pair |
| IS_EMAIL_VERIFIED | false | false | Whether the user's email address has been verified |
| MINS_TO_BYPASS_MFA | null | null | Temporary bypass MFA for the user for a specified number of minutes |
| MINS_TO_BYPASS_NETWORK_POLICY | null | null | Temporary bypass network policy on the user for a specified number of minutes |
| RSA_PUBLIC_KEY | null | null | RSA public key of the user |
| RSA_PUBLIC_KEY_FP | null | null | Fingerprint of user's RSA public key. |
| RSA_PUBLIC_KEY_LAST_SET_TIME | null | null | The timestamp at which the RSA public key was last set for the user. Defaults to null if no RSA public key has been set yet. |
| RSA_PUBLIC_KEY_2 | null | null | Second RSA public key of the user |
| RSA_PUBLIC_KEY_2_FP | null | null | Fingerprint of user's second RSA public key. |
| RSA_PUBLIC_KEY_2_LAST_SET_TIME | null | null | The timestamp at which the second RSA public key was last set for the user. Defaults to null if no second RSA public key has been set yet. |
| SCIM_USER_NAME | null | null | User name of an user (required for SCIM provisioning) |
| PASSWORD_LAST_SET_TIME | null | null | The timestamp on which the last non-null password was set for the user. Default to null if no password has been set yet. |
| MINS_TO_BYPASS_SESSION_POLICY | null | null | Temporarily bypass session policy for the given number of minutes. |
| CUSTOM_LANDING_PAGE_URL | null | null | Custom Landing Page of the user |
| CUSTOM_LANDING_PAGE_URL_FLUSH_NEXT_UI_LOAD | false | false | Whether or not to flush the custom landing page of the user on next UI load |
| IS_FROM_ORGANIZATION_USER | false | false | Whether the user is imported from an organization user. |
| ALLOWED_INTERFACES | [ALL] | null | List of interfaces this user is allowed to access. Must be provided as a list: ('ALL'), ('SNOWFLAKE_INTELLIGENCE', 'STREAMLIT') |
| LOCK_DETAILS | {"isAdminLocked":false,"isMfaLocked":false,"isMfaOTPLocked":false,"isMfaTOTPLocked":false,"isPasswordLocked":false,"isSnowflakeLocked":false} | null | Details about why the user is locked, if the user is locked. |
Let's have Snowflake count that grid rather than counting it by eye.
SELECT COUNT(*) AS PROPERTY_COUNT
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));| PROPERTY_COUNT |
|---|
| 44 |
Forty-four properties. And here is how many of them are still sitting at their default value.
SELECT COUNT(*) AS AT_DEFAULT
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()))
WHERE "value" = "default";| AT_DEFAULT |
|---|
| 35 |
Thirty-five. So most of what a user is, we did not write, on a user we defined in three lines.
Look carefully at the lower-case null in that grid, in both the value and the default column. That is not a SQL NULL rendered in lower case. DESCRIBE USER puts the four characters null into a property that has no value, as text. The grids on this page are full of those cells, and they are shown here as the text they are rather than as the grey NULL you saw in the SHOW USERS grid above. Compare the two and the difference is on screen.
Let's pull out the identity properties on their own.
SELECT "property", "value", "default"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()))
WHERE "property" IN ('NAME','LOGIN_NAME','DISPLAY_NAME','FIRST_NAME',
'LAST_NAME','EMAIL','COMMENT')
ORDER BY "property";| property | value | default |
|---|---|---|
| COMMENT | episode 163 - the smallest user, disabled, no password | null |
| DISPLAY_NAME | U_T163 | null |
| null | null | |
| FIRST_NAME | null | null |
| LAST_NAME | null | null |
| LOGIN_NAME | U_T163 | null |
| NAME | U_T163 | null |
Email, first name and last name are all the text null, because we set none of them. The display name and the login name were filled in from the name.
And now the group that decides what the user can actually do.
SELECT "property", "value", "default"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()))
WHERE "property" IN ('DISABLED','DEFAULT_ROLE','DEFAULT_WAREHOUSE',
'DEFAULT_NAMESPACE','DEFAULT_SECONDARY_ROLES',
'MUST_CHANGE_PASSWORD','TYPE')
ORDER BY "property";| property | value | default |
|---|---|---|
| DEFAULT_NAMESPACE | null | null |
| DEFAULT_ROLE | null | null |
| DEFAULT_SECONDARY_ROLES | ["ALL"] | [ALL] |
| DEFAULT_WAREHOUSE | null | null |
| DISABLED | true | false |
| MUST_CHANGE_PASSWORD | false | false |
| TYPE | PERSON | null |
No default role, no default warehouse, no default namespace, type PERSON, and disabled true against a default of false.
Then look at the third row. DEFAULT_SECONDARY_ROLES comes back as ["ALL"] on a brand new user, without our asking for it, and the default column agrees.
That setting is why every role test in this part of the course has to switch the secondary roles off before it proves anything. A user arrives with all of their roles enabled, so USE ROLE on its own never narrows a session down to one role. It invalidated three earlier tests in this level before anybody noticed.
Now a user whose login name is not its name
The name and the login name are two different properties doing two different jobs. Let's set them deliberately apart.
CREATE OR REPLACE USER UMIN_T163
DISABLED = TRUE
LOGIN_NAME = 'signs_in_as_this_T163'
COMMENT = 'episode 163 - name and login name are different things';| status |
|---|
| User UMIN_T163 successfully created. |
SELECT "name", "login_name", "display_name", "disabled"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));| name | login_name | display_name | disabled |
|---|---|---|---|
| UMIN_T163 | SIGNS_IN_AS_THIS_T163 | UMIN_T163 | true |
Two different strings, and both of them real. The user is called one thing and signs in as the other.
So let's look it up by the string it signs in with
SHOW USERS LIKE 'signs\\_in\\_as\\_this\\_T163';| name | created_on | login_name | display_name | first_name | last_name | mins_to_unlock | days_to_expiry | comment | disabled | must_change_password | snowflake_lock | default_warehouse | default_namespace | default_role | default_secondary_roles | ext_authn_duo | ext_authn_uid | mins_to_bypass_mfa | owner | last_success_login | expires_at_time | locked_until_time | has_password | has_rsa_public_key | type | has_mfa | has_pat | has_workload_identity | allowed_interfaces | is_from_organization_user |
|---|
No rows. Counted, to be sure:
SELECT COUNT(*) AS MATCHED_BY_LOGIN_NAME
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));| MATCHED_BY_LOGIN_NAME |
|---|
| 0 |
Zero. The user exists, and that really is the string it authenticates with, and the catalogue cannot find it that way.
SHOW USERS LIKE matches the name. So if somebody hands you a login that is not working, searching for it finds nothing at all, and nothing tells you that you searched the wrong column.
Here are the three name properties side by side, which is the clearest way to keep them straight.
SELECT "property", "value", "default"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()))
WHERE "property" IN ('NAME','LOGIN_NAME','DISPLAY_NAME')
ORDER BY "property";| property | value | default |
|---|---|---|
| DISPLAY_NAME | UMIN_T163 | null |
| LOGIN_NAME | SIGNS_IN_AS_THIS_T163 | null |
| NAME | UMIN_T163 | null |
And what does a rename move?
There are two names. Let's rename the user and see which one follows.
ALTER USER UMIN_T163 RENAME TO UMIN2_T163;| status |
|---|
| Statement executed successfully. |
First, is the old name gone?
SELECT COUNT(*) AS OLD_NAME_ROWS
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));| OLD_NAME_ROWS |
|---|
| 0 |
Zero. Nothing answers to the old name any more. And the new one?
SELECT "name", "login_name", "display_name", "disabled"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));| name | login_name | display_name | disabled |
|---|---|---|---|
| UMIN2_T163 | SIGNS_IN_AS_THIS_T163 | UMIN_T163 | true |
The name moved. The login name did not.
So renaming a user does not change how they sign in. That is either a relief or a trap, depending entirely on why you renamed them. Let's put the name back and carry on.
ALTER USER UMIN2_T163 RENAME TO UMIN_T163;| status |
|---|
| Statement executed successfully. |
Now let's point a user at things that are not there
This is the part of the episode I would put on a poster. Let's set the default role to a role name I have just invented.
ALTER USER U_T163 SET DEFAULT_ROLE = ROLE_THAT_DOES_NOT_EXIST_T163;| status |
|---|
| Statement executed successfully. |
Statement executed successfully. Let's read it back.
SELECT "name", "default_role", "disabled"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));| name | default_role | disabled |
|---|---|---|
| U_T163 | ROLE_THAT_DOES_NOT_EXIST_T163 | true |
The user is carrying it. The string went in exactly as it was typed, with no warning and no check.
And the same for a warehouse.
ALTER USER U_T163 SET DEFAULT_WAREHOUSE = WH_THAT_DOES_NOT_EXIST_T163;| status |
|---|
| Statement executed successfully. |
SELECT "name", "default_role", "default_warehouse"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));| name | default_role | default_warehouse |
|---|---|---|
| U_T163 | ROLE_THAT_DOES_NOT_EXIST_T163 | WH_THAT_DOES_NOT_EXIST_T163 |
So that user now names two things, and neither of them exists on the account.
Here is why that is allowed, and it is not a bug
Let's make one more user, this time with every property we are willing to set, including a DEFAULT_ROLE that really does exist.
CREATE OR REPLACE USER UFULL_T163
DISABLED = TRUE
LOGIN_NAME = 'ufull_login_T163'
DISPLAY_NAME = 'Episode 163 Demo User'
FIRST_NAME = 'Demo'
LAST_NAME = 'User'
EMAIL = 'demo.user@example.com'
DEFAULT_ROLE = RDEF_T163
DEFAULT_NAMESPACE = 'DEMO_DB.PUBLIC'
COMMENT = 'episode 163 - every property I am willing to set';| status |
|---|
| User UFULL_T163 successfully created. |
SHOW USERS LIKE 'UFULL\\_T163';| name | created_on | login_name | display_name | first_name | last_name | mins_to_unlock | days_to_expiry | comment | disabled | must_change_password | snowflake_lock | default_warehouse | default_namespace | default_role | default_secondary_roles | ext_authn_duo | ext_authn_uid | mins_to_bypass_mfa | owner | last_success_login | expires_at_time | locked_until_time | has_password | has_rsa_public_key | type | has_mfa | has_pat | has_workload_identity | allowed_interfaces | is_from_organization_user | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| UFULL_T163 | 2026-10-06 12:21:30.137000-07:00 | UFULL_LOGIN_T163 | Episode 163 Demo User | Demo | User | demo.user@example.com | NULL | NULL | episode 163 - every property I am willing to set | true | false | false | NULL | DEMO_DB.PUBLIC | RDEF_T163 | ["ALL"] | false | NULL | NULL | ACCOUNTADMIN | NULL | NULL | NULL | false | false | PERSON | false | false | false | [ALL] | false |
Nine properties set, all of them in that one statement, and still disabled with no password. Now let's ask what roles that user actually holds.
SHOW GRANTS TO USER UFULL_T163;| created_on | privilege | granted_on | name | role | granted_to | grantee_name | grant_option | granted_by |
|---|
No rows. A default role is not a grant. It is a preference about which role to put on when the user arrives, and writing it down gives the user nothing.
The grant is a separate statement.
GRANT ROLE RDEF_T163 TO USER UFULL_T163;| status |
|---|
| Statement executed successfully. |
SELECT "role", "granted_to", "grantee_name", "granted_by"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));| role | granted_to | grantee_name | granted_by |
|---|---|---|---|
| RDEF_T163 | USER | UFULL_T163 | ACCOUNTADMIN |
One row now: the role, granted to a user, the user it was granted to, and who granted it.
And that user is disabled the whole time. Those two facts sit in different columns and neither one affects the other.
SELECT "name", "disabled", "default_role"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));| name | disabled | default_role |
|---|---|---|
| UFULL_T163 | true | RDEF_T163 |
So DEFAULT_ROLE accepting a name that does not exist is consistent: it is a preference, not an authorisation, and preferences are not checked against the catalogue. It is still worth knowing, because the user who cannot log in properly next month will have this written on them and nothing will say it is the reason.
Now let's set some properties and unset them again
First, put that user back to something real and clear the warehouse out entirely.
ALTER USER U_T163 SET DEFAULT_ROLE = PUBLIC;| status |
|---|
| Statement executed successfully. |
ALTER USER U_T163 UNSET DEFAULT_WAREHOUSE;| status |
|---|
| Statement executed successfully. |
SELECT "name", "default_role", "default_warehouse", "disabled"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));| name | default_role | default_warehouse | disabled |
|---|---|---|---|
| U_T163 | PUBLIC | NULL | true |
Default role PUBLIC, default warehouse back to a real SQL null, still disabled. Tidy again.
Now let's set two properties in one statement and read both back.
ALTER USER U_T163 SET
COMMENT = 'episode 163 - altered once',
EMAIL = 'altered@example.com';| status |
|---|
| Statement executed successfully. |
SELECT "name", "email", "comment", "disabled"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));| name | comment | disabled | |
|---|---|---|---|
| U_T163 | altered@example.com | episode 163 - altered once | true |
Both landed. Now let's unset just the email.
ALTER USER U_T163 UNSET EMAIL;| status |
|---|
| Statement executed successfully. |
SELECT "name", "email", "comment"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));| name | comment | |
|---|---|---|
| U_T163 | NULL | episode 163 - altered once |
The email is back to null and the comment is untouched. UNSET takes exactly what you name and nothing else.
And after all that, is the user still disabled?
SELECT "property", "value", "default"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()))
WHERE "property" = 'DISABLED';| property | value | default |
|---|---|---|
| DISABLED | true | false |
true, against a default of false. Nothing we did woke that user up.
What happens when a name clashes?
Two ways a name goes wrong, and they are two different errors.
A name that already exists
CREATE USER U_T163 DISABLED = TRUE;002002 (42710): SQL compilation error: Object 'U_T163' already exists.
002002, naming the object. Now the same statement with IF NOT EXISTS, and a comment in it that we have not used before.
CREATE USER IF NOT EXISTS U_T163 DISABLED = TRUE
COMMENT = 'episode 163 - this comment should NOT appear';| status |
|---|
| U_T163 already exists, statement succeeded. |
Already exists, statement succeeded. So let's see what happened to the comment.
SELECT "name", "comment", "disabled"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));| name | comment | disabled |
|---|---|---|
| U_T163 | episode 163 - altered once | true |
It is still the comment the earlier ALTER set. The comment in the CREATE USER IF NOT EXISTS was ignored, silently.
That is the useful half of this. IF NOT EXISTS does not mean create or update. If the object is there, the whole statement is skipped and every option in it goes with it.
A login name that belongs to somebody else
CREATE OR REPLACE USER UCLASH_T163
DISABLED = TRUE
LOGIN_NAME = 'ufull_login_T163';003006 (42710): SQL compilation error: User with login name 'UFULL_LOGIN_T163' already exists.
A different code, 003006, and a different sentence: a user with that login name already exists. So login names are unique across the account, the same as names are, and the two clashes are reported separately.
And dropping a user that is not there
A plain DROP USER on a name that does not exist is refused. That refusal is not on this page: its message quotes the account locator, and an error pane here is printed exactly as it was captured and never edited, so it is left out rather than trimmed.
DROP USER NO_SUCH_USER_T163;With IF EXISTS it is a no-op, and the status line says so in a nice way.
DROP USER IF EXISTS NO_SUCH_USER_T163;| status |
|---|
| Drop statement executed successfully (NO_SUCH_USER_T163 already dropped). |
A user has parameters as well as properties
Properties are what the user is. Parameters are session settings that apply to it, and there are rather a lot of them.
SHOW PARAMETERS IN USER U_T163;SELECT COUNT(*) AS PARAMETER_COUNT
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));| PARAMETER_COUNT |
|---|
| 180 |
A hundred and eighty. Let's look at five of them, and read the level column.
SELECT "key", "value", "default", "level"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()))
WHERE "key" IN ('TIMEZONE','WEEK_START','QUERY_TAG','AUTOCOMMIT',
'STATEMENT_TIMEOUT_IN_SECONDS')
ORDER BY "key";| key | value | default | level |
|---|---|---|---|
| AUTOCOMMIT | true | true | |
| QUERY_TAG | |||
| STATEMENT_TIMEOUT_IN_SECONDS | 172800 | 172800 | |
| TIMEZONE | America/Los_Angeles | America/Los_Angeles | |
| WEEK_START | 0 | 0 |
The level column is empty on all five, and the value matches the default in every row. Empty level means nobody set it here. Every parameter on that user is inherited from above it.
Now let's set one on the user and look again.
ALTER USER U_T163 SET TIMEZONE = 'Asia/Karachi';| status |
|---|
| Statement executed successfully. |
SELECT "key", "value", "default", "level"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()))
WHERE "key" = 'TIMEZONE';| key | value | default | level |
|---|---|---|---|
| TIMEZONE | Asia/Karachi | America/Los_Angeles | USER |
The value is ours, the default is still the account's, and level now reads USER. Same column and same meaning as on a warehouse, several levels back in this course.
And unset it.
ALTER USER U_T163 UNSET TIMEZONE;| status |
|---|
| Statement executed successfully. |
SELECT "key", "value", "default", "level"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()))
WHERE "key" = 'TIMEZONE';| key | value | default | level |
|---|---|---|---|
| TIMEZONE | America/Los_Angeles | America/Los_Angeles |
Back to the default, empty level, and no record anywhere that we were ever there.
One last thing: authentication policies
How a user is allowed to authenticate is a separate object with its own properties. Let's make one with a single method.
CREATE OR REPLACE AUTHENTICATION POLICY AUTHPOL_T163
AUTHENTICATION_METHODS = ('PASSWORD')
MFA_ENROLLMENT = 'OPTIONAL'
COMMENT = 'episode 163 - created, read, dropped, APPLIED TO NOTHING';| status |
|---|
| Authentication policy 'AUTHPOL_T163' created successfully |
And describe it.
DESCRIBE AUTHENTICATION POLICY AUTHPOL_T163;| property | value | default | description |
|---|---|---|---|
| NAME | AUTHPOL_T163 | null | Name of authentication policy. |
| OWNER | ACCOUNTADMIN | null | Owner of authentication policy. |
| COMMENT | episode 163 - created, read, dropped, APPLIED TO NOTHING | null | Comment associated with authentication policy. |
| AUTHENTICATION_METHODS | [PASSWORD] | [ALL] | Authentication methods that are allowed for usage. |
| CLIENT_TYPES | [ALL] | [ALL] | Client types that are allowed for access. |
| CLIENT_POLICY | {} | null | Client policy for the authentication policy. |
| SECURITY_INTEGRATIONS | [ALL] | [ALL] | Security integrations that are allowed for authentication. |
| MFA_ENROLLMENT | OPTIONAL | OPTIONAL | When set to REQUIRED, force a user to enroll in MFA according to the MFA_AUTHENTICATION_METHODS. Allowed values are REQUIRED | OPTIONAL |
| MFA_POLICY | {ALLOWED_METHODS=[ALL], ENFORCE_MFA_ON_EXTERNAL_AUTHENTICATION=NONE} | {ALLOWED_METHODS=[ALL], ENFORCE_MFA_ON_EXTERNAL_AUTHENTICATION=NONE} | MFA-specific configuration for the authentication policy. |
| PAT_POLICY | {DEFAULT_EXPIRY_IN_DAYS=15, MAX_EXPIRY_IN_DAYS=365, NETWORK_POLICY_EVALUATION=ENFORCED_REQUIRED, REQUIRE_ROLE_RESTRICTION_FOR_SERVICE_USERS=true, REQUIRE_ROLE_RESTRICTION_FOR_PERSON_USERS=false, BLOCKED_ROLES_LIST=[]} | null | PAT-specific configuration for the authentication policy. |
| WORKLOAD_IDENTITY_POLICY | {ALLOWED_PROVIDERS=[ALL], ALLOWED_AWS_ACCOUNTS=[ALL], ALLOWED_AWS_PARTITIONS=[ALL], ALLOWED_AZURE_ISSUERS=[ALL], ALLOWED_OIDC_ISSUERS=[ALL]} | null | Workload identity-specific configuration for the authentication policy. |
Eleven properties. The method list is ours, the MFA enrolment is optional, and look at the PAT_POLICY row: a programmatic access token policy arrives fully filled in, with its own default expiry and its own rules, without our writing a word of it.
This policy was applied to nothing. It was created, read and dropped.
And a method that is not a method
CREATE OR REPLACE AUTHENTICATION POLICY BADPOL_T163
AUTHENTICATION_METHODS = ('TELEPATHY');003618 (22023): SQL Compilation Error: TELEPATHY invalid for Authentication Methods.
003618, and it names exactly what it did not like. A closed list, and the refusal quotes the word we got wrong back at us.
SHOW AUTHENTICATION POLICIES LIKE 'BADPOL\\_T163';| created_on | name | database_name | schema_name | kind | owner | comment | owner_role_type | options |
|---|
No rows, so nothing was half made.
Everything above was created by this post and dropped again afterwards.
-- Putting the account back.
USE ROLE ACCOUNTADMIN;
DROP USER IF EXISTS U_T163;
DROP USER IF EXISTS UMIN_T163;
DROP USER IF EXISTS UFULL_T163;
DROP ROLE IF EXISTS RDEF_T163;
DROP AUTHENTICATION POLICY IF EXISTS AUTHPOL_T163;
-- And then the real account user is described once more, read and never
-- written, to prove nothing here touched it.
DESCRIBE USER YOUR_USER;That last DESCRIBE USER is the account's real user, read and never written, and its grid is not on this page for the same reason as the one at the top.
Key points
DESCRIBE USERgives forty-four properties, and on a user defined in three lines, thirty-five of them were still at their default.- An unset property comes back as the text
null, not as a SQL NULL.SHOW USERSgives real nulls for the same information. DEFAULT_SECONDARY_ROLESis["ALL"]on a brand new user, which is why role tests have to switch the secondary roles off.- A user has a name and a login name, and
SHOW USERS LIKEmatches the name. - So looking a user up by the string it signs in with finds nothing, and nothing says you searched the wrong column.
RENAMEmoves the name only. The login name is untouched.DEFAULT_ROLEwill accept a role that does not exist, and the statement succeeds.- Because a default role is a preference, not a grant.
SHOW GRANTS TO USERwas empty until a separateGRANT ROLEran. - A user can hold a role and be disabled at the same time. Different columns, no interaction.
CREATE USER IF NOT EXISTSskips the whole statement, so every option in it is ignored, silently.- A name clash is
002002. A login name clash is003006. - A user also has a hundred and eighty parameters, and the
levelcolumn tells you whether anybody set one here.
In the next post we will look at network policies: the difference between a rule and the list that uses it, and what happens when you point a policy at an address range that does not do what you think.
Every query and every result grid on this page was captured from a live Snowflake account (version 10.36.101) running the demo script for this episode. The three users it creates are all created DISABLED, no password or key is set on any of them, and all three are dropped at the end. The authentication policy was created, read and applied to nothing. The account's own user is read and never written, and every grid that carries that user's details, or the account locator, is left off the page rather than edited, with the statement shown instead. Nothing is timed and no performance claims are made anywhere in this series. Behaviour follows the Snowflake CREATE USER documentation.



No comments:
Post a Comment
Note: Only a member of this blog may post a comment.