Choose a policy for the correct point in the session
A security review asks Maple Market to approve sign-in methods, require prompt reauthentication for unattended analyst sessions and manage remaining Snowflake passwords. Each is a different decision with different effects on people and scheduled work.
An authentication policy defines allowed authentication methods and can restrict compatible clients or security integrations and control applicable MFA settings. A user-level authentication policy overrides the account-level policy for that user. Changes still have to satisfy Snowflake’s enforced strong-authentication requirements. CLIENT_TYPES is a best-effort control and is not an authorization or network boundary.
A session policy controls how long sessions can stay idle and can set additional session time limits. A password policy governs passwords managed by Snowflake, for example length, age or reuse. The IdP owns the password rules for credentials it manages. Check edition support for the chosen session controls and client behavior before setting production values.
| Question | Policy to inspect |
|---|---|
| Can this identity sign in with this method? | Authentication policy |
| How long can an unused session remain signed in? | Session policy |
| What applies to a password managed by Snowflake? | Password policy |
Test one approved user and prepare a secure recovery path
Inventory the current sign-in paths for people, services and approved recovery administrators. Check client versions and the expected method before rollout. Ask the administrator to record the current policy assignments and verify a separate recovery path that retains strong authentication and approved network access.
Use a disposable or tightly scoped pilot identity first. Verify its expected allowed connection and the policy rejection of one disallowed method. Check that the pilot can still perform its intended job and review login history. Roll out through an approved change after the pilot evidence is clear. Never weaken MFA or an account-wide security policy to restore routine access.
Create and test three policies on dedicated users
A policy is a reusable set of rules. Snowflake evaluates network policy first, then the allowed authentication path. Local passwords have their own rules. After a session starts, session policy governs supported time limits. A user-specific policy can override an account baseline for its policy type. Check user, user-type and account settings before choosing the pilot.
Use a disposable account or approved isolated pilot. Have an existing SAML integration and an approved PERSON user for it, and a different dedicated PERSON user for the Snowflake-managed password case. Confirm neither has a user override. Record the account baseline and verify a second strongly authenticated administrator before applying any policy. Do not change an account-wide policy in this lab.
Use a delegated role with CREATE AUTHENTICATION POLICY, CREATE SESSION POLICY and CREATE PASSWORD POLICY on the schema, appropriate parent access, and the relevant APPLY privileges. Use APPLY AUTHENTICATION POLICY on the account and APPLY SESSION POLICY or APPLY PASSWORD POLICY on the respective pilot user for these user-level assignments. A platform owner creates the scratch schema if needed. Check edition and client support for the intended session settings.
Restrict the sign-in method and integration
The policy author creates M17D_SAML_ONLY. AUTHENTICATION_METHODS governs the protocol. SECURITY_INTEGRATIONS lists the trusted SAML integration by name. MFA_ENROLLMENT sets the enrollment requirement. MFA_POLICY makes Snowflake require MFA for external sign-in in this pilot. Verify required MFA support and enroll the pilot through Snowsight before enforcing it.
The policy administrator applies the policy to just the SAML pilot. Expect a fresh allowed SAML login using the approved integration and required factor. Test an alternate method only with an approved test client and identity. Record the method-specific rejection. If no alternate login was provisioned, treat the expected denial as untested.
CREATE AUTHENTICATION POLICY <POLICY_DB>.<POLICY_SCHEMA>.M17D_SAML_ONLY
AUTHENTICATION_METHODS = ('SAML')
SECURITY_INTEGRATIONS = ('<APPROVED_SAML_INTEGRATION>')
MFA_ENROLLMENT = 'REQUIRED'
MFA_POLICY = (ENFORCE_MFA_ON_EXTERNAL_AUTHENTICATION = 'ALL');
DESCRIBE AUTHENTICATION POLICY <POLICY_DB>.<POLICY_SCHEMA>.M17D_SAML_ONLY;
ALTER USER <SAML_PILOT> SET AUTHENTICATION POLICY <POLICY_DB>.<POLICY_SCHEMA>.M17D_SAML_ONLY;
SELECT * FROM TABLE(<POLICY_DB>.INFORMATION_SCHEMA.POLICY_REFERENCES(
POLICY_NAME => '<POLICY_DB>.<POLICY_SCHEMA>.M17D_SAML_ONLY'
));Limit idle time and check reauthentication
The policy author sets 15 minutes for an idle driver session and 10 minutes for Snowsight. The maximum lifespan is different. It limits time even with activity. This example sets a 60-minute maximum for both. Apply it to the SAML pilot. Open a fresh session, run SELECT CURRENT_USER(), then leave it unused without keep-alives or auto-refresh.
Expect the idle session to require authentication again at the next operation. Test programmatic and browser clients separately. Driver reconnect behavior and a still-active IdP browser session can hide a visible sign-in prompt. Record connection IDs or timestamps to distinguish a fresh session from an old one.
CREATE SESSION POLICY <POLICY_DB>.<POLICY_SCHEMA>.M17D_SESSION
SESSION_IDLE_TIMEOUT_MINS = 15
SESSION_UI_IDLE_TIMEOUT_MINS = 10
SESSION_MAX_LIFESPAN_MINS = 60
SESSION_UI_MAX_LIFESPAN_MINS = 60;
DESCRIBE SESSION POLICY <POLICY_DB>.<POLICY_SCHEMA>.M17D_SESSION;
ALTER USER <SAML_PILOT> SET SESSION POLICY <POLICY_DB>.<POLICY_SCHEMA>.M17D_SESSION;
SELECT * FROM TABLE(<POLICY_DB>.INFORMATION_SCHEMA.POLICY_REFERENCES(
POLICY_NAME => '<POLICY_DB>.<POLICY_SCHEMA>.M17D_SESSION'
));Test a password change on the local-password pilot
Create a minimum length of 16 with at least one uppercase letter, lowercase letter, digit and special character. Apply it only to the dedicated local-password identity. In the approved password change interface, use temporary values that you never save in SQL or logs. Try a value below the minimum once, then use a new vault-generated value that meets the policy and test login with required MFA.
Expect the short replacement to be rejected and the compliant one to be accepted. The policy affects Snowflake-managed passwords. It does not set the IdP’s password rules. It also does not imply that every existing password is rewritten as soon as it is applied.
CREATE PASSWORD POLICY <POLICY_DB>.<POLICY_SCHEMA>.M17D_PASSWORD
PASSWORD_MIN_LENGTH = 16
PASSWORD_MIN_UPPER_CASE_CHARS = 1
PASSWORD_MIN_LOWER_CASE_CHARS = 1
PASSWORD_MIN_NUMERIC_CHARS = 1
PASSWORD_MIN_SPECIAL_CHARS = 1;
DESCRIBE PASSWORD POLICY <POLICY_DB>.<POLICY_SCHEMA>.M17D_PASSWORD;
ALTER USER <PASSWORD_PILOT> SET PASSWORD POLICY <POLICY_DB>.<POLICY_SCHEMA>.M17D_PASSWORD;
SELECT * FROM TABLE(<POLICY_DB>.INFORMATION_SCHEMA.POLICY_REFERENCES(
POLICY_NAME => '<POLICY_DB>.<POLICY_SCHEMA>.M17D_PASSWORD'
));Restore the baseline and remove the pilot policies
Use the role with the appropriate APPLY privilege to remove the three user links. Use the object owner to drop the three policies after verifying no other identities use them. The lab assumes there was no user override before the test. If you did have one, use the recorded approved configuration to restore it.
Repeat one allowed sign-in through the baseline. In production, verify a separate recovery administrator and pilot both people and services before any broader rollout. CLIENT_TYPES is best effort. Use network policy and precise method and integration restrictions for the access boundary.
ALTER USER <SAML_PILOT> UNSET AUTHENTICATION POLICY;
ALTER USER <SAML_PILOT> UNSET SESSION POLICY;
ALTER USER <PASSWORD_PILOT> UNSET PASSWORD POLICY;
DROP AUTHENTICATION POLICY <POLICY_DB>.<POLICY_SCHEMA>.M17D_SAML_ONLY;
DROP SESSION POLICY <POLICY_DB>.<POLICY_SCHEMA>.M17D_SESSION;
DROP PASSWORD POLICY <POLICY_DB>.<POLICY_SCHEMA>.M17D_PASSWORD;Diagnose a denied login or an expired session
If a pilot cannot sign in, compare the selected integration and login method with the effective user and account policies and check the network first. The account may still enforce stronger authentication requirements. Narrow pilot troubleshooting to the affected identity.
If an idle connection remains active, check whether a driver, application heartbeat or browser refresh kept it in use. Test a truly idle client and keep the clock evidence. If a replacement password fails, check the rules at time of change and whether Snowflake or the IdP owns the password.
Explain the design in an interview
Name the rule, then explain how you would prove it.
How do you restrict SSO to one provider?
I would allow the SAML method and name the approved integration in the authentication policy. I would test a pilot and confirm both the sign-in method and factor settings.
Why does a session appear active after its idle timeout?
I would check for background activity or an automatic reconnect. The IdP may still have a valid browser session. I would compare timestamps and session IDs to see what actually happened.
Words used in this lesson
- Authentication policy
- Rules that govern allowed ways to authenticate.
- Session policy
- Rules governing supported session time limits.
- Password policy
- Rules for passwords managed by Snowflake.
See how it works
Choose a step to explore the idea at your own pace.
Open the interactive explanation
Snowflake Authentication, Session and Password Policies: Setup and Testing
Pick a policy type
Match the control to sign-in, session lifetime or a Snowflake-managed password.
Automatic playback is off for reduced motion. Select any step or use Previous and Next. Illustrations explain behavior; they are not live measurements.
Read the complete diagram explanation
- Pick a policy type
Match the control to sign-in, session lifetime or a Snowflake-managed password.
Authentication → Session → Password
- Test a staged change
Verify the intended pilot connection and a rejected method while a protected recovery path remains available.
Existing policy recorded → Pilot evidence → Approved rollout
Try the SQL or command
Read → predict → run in your learning environment → compare. You can also learn by reading without an account.
New to SQL? Where to run it and how to read it
A query is a question written in SQL. Snowflake runs it and returns a result table. This website shows examples; it does not connect to your account.
- No account yet? Read and predict the output first. Follow the account and Snowsight lesson when you are ready.
- For SQL practice, use a learning account in Snowsight and select an authorized role and warehouse. A role determines permissions; a warehouse supplies processing power. Follow the example’s database/schema setup when it refers to stored objects.
- Read the entire example, including comments beginning with
--. Run the selected statement or labeled block in the stated order. Examples labeled Python, shell or HTTP belong in that client, not in a SQL editor. - Compare values and row counts with the explained result. If an example deliberately causes an error, follow its rollback and cleanup steps before continuing.
- SELECT / FROM
- Choose the values to return / identify their input.
- VALUES / COLUMN1
- VALUES supplies tiny example rows. COLUMN1 means their first column, COLUMN2 their second.
- AS / WITH
- AS gives a result a readable name. WITH names a temporary query step within one statement.
- NULL / ::
- NULL means missing or unknown. The :: notation converts a value to a named data type.
- Session
- One connection and its settings. Keep related transaction steps in the same session.
- Database.schema.table
- A full address for stored data. It is separate from the warehouse that processes queries.
Need the L2_OBJECTS_LAB setup? Open the first database-object lesson →
Help with common practice errors
- No active warehouse: select a warehouse your role can use. Do not assume you need to create a new one.
- Object missing or not authorized: check the full name, required setup and active role. Ask the account owner for access if needed.
- Object already exists: setup may already have run. Read the current state or choose a fresh lab name consistently; do not add OR REPLACE blindly.
- Different result: check whether an earlier INSERT or UPDATE changed the data. VALUES examples provide their own fresh input for each statement.
Inspect a policy before a pilot
DESCRIBE AUTHENTICATION POLICY <approved_lab_policy>;What to expect and why
Use a role with access to the existing named policy. Review AUTHENTICATION_METHODS, client restrictions and configured integrations. The result describes that policy. Confirm which policy is actually attached to the pilot user and which account default applies before interpreting the result.
Check your understanding
Choose an answer, then check your reasoning. This is practice, not a scored test.
Try it yourself
An authorized pilot can still sign in but the connection flow is different than expected. What would you compare?
Compare your reasoning
Check the user-specific authentication policy against the account default, plus the client version and chosen integration. Reproduce the exact connection through the supported client.
Official sources and curriculum
Module 17 · See module scope
By Rohit Ray · Independent educational lesson · Explore this visual lab