Skip to content
Tutorials Center
My learning

Topics

Lesson 27 of 38 ยท Security and Governance

Authentication, MFA and Network Policies

Secure access to Snowflake: password and MFA, SSO, key-pair authentication, service users, tokens, SCIM and network policies that allow or block IP ranges.

Roles decide what a user may do. Authentication decides who the user is, and network policies decide where they may connect from. Snowflake offers several authentication methods, and the right one depends on whether the caller is a person or a program.

Authentication for people

Username and password is the baseline. On its own it is weak, so Snowflake pushes multi-factor authentication (MFA): after the password, the user confirms with an authenticator app, a passkey or a hardware key. Accounts are expected to require MFA for password sign-ins; you can enforce it through an authentication policy.

Single sign-on (SSO) federates identity to your company's provider (Okta, Microsoft Entra ID, Ping and others, through SAML 2.0 or OAuth). People sign in once with the corporate identity, you get central offboarding and conditional access, and Snowflake never sees a password.

SCIM (System for Cross-domain Identity Management) lets the identity provider create, update and deactivate Snowflake users and roles automatically, so leaving the company ends access everywhere at once.

SQL
CREATE USER maria
  LOGIN_NAME = '[email protected]'
  DEFAULT_ROLE = analyst
  DEFAULT_WAREHOUSE = reporting_wh
  MUST_CHANGE_PASSWORD = TRUE;

Authentication for programs

A script or application should not use a person's password. Options:

  • Key-pair authentication: the program signs a JWT with a private key; Snowflake stores only the public key. No password travels over the network, and keys can be rotated (a user can hold two public keys during rotation).
  • OAuth: the caller obtains a short-lived access token from an authorization server.
  • Programmatic access tokens (PATs): revocable tokens tied to a user and, ideally, a specific role, with an expiry date.
  • Service users (TYPE = SERVICE): accounts for software that cannot sign in with a password or MFA, restricted to key-pair or token methods.
SQL
CREATE USER etl_service
  TYPE = SERVICE
  DEFAULT_ROLE = loader
  RSA_PUBLIC_KEY = 'MIIBIjANBgkq...';   -- public key only

ALTER USER etl_service SET RSA_PUBLIC_KEY_2 = 'MIIBIjANBgkq...';  -- rotation slot

Rule of thumb: people use SSO plus MFA; software uses key pairs or OAuth. Never put passwords in code or in version control.

Authentication policies

An authentication policy states which methods and clients are allowed for an account or for specific users:

SQL
CREATE AUTHENTICATION POLICY humans_with_mfa
  AUTHENTICATION_METHODS = ('SAML', 'PASSWORD')
  MFA_ENROLLMENT = REQUIRED
  CLIENT_TYPES = ('SNOWFLAKE_UI', 'DRIVERS', 'SNOWSQL');

ALTER ACCOUNT SET AUTHENTICATION POLICY humans_with_mfa;
ALTER USER etl_service SET AUTHENTICATION POLICY service_keys_only;

Network policies

A network policy is an allow-list (and optional block-list) of IP addresses or CIDR ranges. A user, or the whole account, can only connect from allowed addresses. Blocked addresses are evaluated first, so a blocked entry wins over an allowed one.

SQL
CREATE NETWORK RULE office_ips
  MODE = INGRESS
  TYPE = IPV4
  VALUE_LIST = ('203.0.113.0/24', '198.51.100.17');

CREATE NETWORK POLICY office_only
  ALLOWED_NETWORK_RULE_LIST = ('office_ips');

ALTER ACCOUNT SET NETWORK_POLICY = office_only;     -- everyone
ALTER USER etl_service SET NETWORK_POLICY = etl_hosts;   -- a user policy overrides

If a user has a policy, it takes precedence over the account policy. Be careful: setting an account policy that excludes your own address locks you out.

Python Allow-list check with CIDR ranges (stand-in)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

This stand-in uses Python's ipaddress module to show how CIDR matching and the block-first rule behave. Snowflake does the real check at login time.

SQL Auditing logins with SQL (stand-in) ยท database: company

Press Run (or Ctrl + Enter) to see the result here.

In the real product the equivalent is SNOWFLAKE.ACCOUNT_USAGE.LOGIN_HISTORY (columns USER_NAME, CLIENT_IP, FIRST_AUTHENTICATION_FACTOR, SECOND_AUTHENTICATION_FACTOR, IS_SUCCESS). Repeated failures and password sign-ins without a second factor are the things to alert on.

Other protections

  • Session policies set idle timeouts and which roles can run in an idle session.
  • Password policies control length, complexity, age and retry limits.
  • Private connectivity (AWS PrivateLink, Azure Private Link, Google Private Service Connect) keeps traffic off the public internet.
  • Encryption is always on: data at rest uses AES-256 with a hierarchical key model and automatic key rotation; traffic uses TLS. Tri-Secret Secure lets you add your own key (Business Critical edition).
  • Trust Center scans an account for security risks and recommends fixes.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which method suits a scheduled ETL script?

    Programs should use key-pair, OAuth or tokens, with credentials stored in a secret manager.
  2. 2. In a network policy, what happens if an IP is both allowed and blocked?

    Blocked entries are evaluated first, so blocking wins.
  3. 3. What does SCIM do?

    SCIM keeps Snowflake users in sync with your identity provider, so offboarding is automatic.
  4. 4. A user has a user-level network policy and the account has a different one. Which applies to that user?

    A policy set on a user takes precedence over the account-level policy.

Summary

  • People: SSO plus MFA, provisioned by SCIM; programs: key pair, OAuth or tokens with service users.
  • Authentication policies restrict methods; network policies restrict IP ranges, block list first.
  • Add session and password policies, private connectivity and monitor LOGIN_HISTORY.
  • Test a network policy carefully so you do not lock yourself out.

Next: Masking and row access policies