Accounts and Security · Topic 17 of 17

Multi-Factor Authentication and Key-Pair Authentication

Enforce MFA for people and key-pair authentication for services: passkeys, TOTP, Duo, MFA caching, RSA keys, rotation and public key assignment.

  • 5 min
In a nutshell
  • MFA methods: passkey, authenticator app (TOTP) and Duo; MFA_ENROLLMENT and MFA_POLICY live in an authentication policy.
  • MINS_TO_BYPASS_MFA gives a locked out user temporary single factor access.
  • ALLOW_CLIENT_MFA_CACHING caches an MFA token for up to four hours.

What it is

Multi-factor authentication (MFA) asks a human for a second proof after the password. Key-pair authentication replaces the password entirely for programs: the client proves identity by signing with a private key, and Snowflake checks the signature against the public key stored on the user.

They fit different users. MFA is for people who sign in with a password. Key-pair is for service users, automation and drivers, which cannot answer an MFA prompt.

PersonpasswordthenSecond factorpasskey, TOTP, DuookSessionServiceprivate keysignsJWTchecked againstPublic keyon the userokSession

How it works

MFA methods

MethodNotes
PasskeyRecommended; phishing resistant
Authenticator app (TOTP)Time based one-time passcodes
DuoDuo Push is the default for enrolled users in most drivers; not replicated like the other methods

MFA applies to human users who sign in with a password. Service users must use another method. New accounts require password-authenticating human users to enroll by default, and older accounts must be configured to require it. Snowflake is rolling out MFA for all password sign-ins, so a temporary opt-out exists through an authentication policy with MFA_ENROLLMENT = OPTIONAL.

Users add their own methods in Snowsight. An administrator can make a locked out user enroll again with ALTER USER ... ENROLL MFA.

Enforcing MFA with authentication policies

SettingEffect
MFA_ENROLLMENT = REQUIREDUsers must enroll; SNOWFLAKE_UI must stay in CLIENT_TYPES
MFA_POLICY (ALLOWED_METHODS = ('PASSKEY'))Restricts which methods may be used
MFA_POLICY (ENFORCE_MFA_ON_EXTERNAL_AUTHENTICATION = 'ALL')Requires Snowflake MFA after SAML or OIDC sign-in

By default SSO users rely on the IdP's MFA. Use the enforcement setting only when Snowflake itself must also ask for a second factor.

Exam tip

For SSO users, put MFA in the IdP. Add Snowflake MFA on top only when a rule demands a second check inside Snowflake.

Recovery and bypass

SituationCommand
Locked out user needs temporary accessALTER USER u SET MINS_TO_BYPASS_MFA = 30
Remove a lost deviceALTER USER u REMOVE MFA METHOD name (find names with SHOW MFA METHODS FOR USER u)
Break glass codesALTER USER u ADD MFA METHOD OTP COUNT = n

One-time passcodes are single use. They are not replicated to target accounts.

MFA token caching

Repeated MFA prompts annoy users of drivers and tools that open many connections. An ACCOUNTADMIN can enable caching.

ALTER ACCOUNT SET ALLOW_CLIENT_MFA_CACHING = TRUE;

The client then uses authenticator=username_password_mfa. A cached token is valid for up to four hours and becomes invalid if the credentials or authentication method change. Cached use shows as MFA_TOKEN in LOGIN_HISTORY.

Watch out

Caching trades a little security for convenience. Do not enable it where a stolen laptop would be a high risk.

Key-pair authentication

The client holds the private key. The user in Snowflake holds the public key. Each connection builds a signed JWT, and Snowflake verifies it against the stored key, so no password crosses the wire.

Key requirements:

  • An RSA key pair of at least 2048 bits in PEM format.
  • The private key can be encrypted (safer) or unencrypted. AES-256-CBC is the suggested cipher.
  • The public key is derived from the private key.

Assigning the public key needs the privilege MODIFY PROGRAMMATIC AUTHENTICATION METHODS on the user, or OWNERSHIP of the user.

MethodCommandNotes
Named key pair (recommended)ALTER USER u ADD KEY PAIR ...Supports names, role restriction and expiry
Property based (legacy)ALTER USER u SET RSA_PUBLIC_KEY = '...'No role restriction or expiry; omit the PEM header and footer lines

Run DESC USER and read RSA_PUBLIC_KEY_FP to see the fingerprint of the assigned key.

Rotation

Rotation lets you replace a key with no outage.

ApproachSteps
Named key pairsGenerate a new pair, run ALTER USER u ROTATE KEY PAIR ..., then update the client. The old key stays valid for 24 hours by default (EXPIRE_ROTATED_KEY_PAIR_AFTER_HOURS, where 0 expires it at once).
Property basedA user can hold two keys, in RSA_PUBLIC_KEY and RSA_PUBLIC_KEY_2. Put the new key in the free slot, update the client, then run UNSET on the old one.
New key pairgenerateADD or ROTATEUsertwo keys validclient switchesNew private keythenOld keyexpires or UNSET

Choosing

ScenarioAnswer
Employee signs in with a passwordMFA, preferably a passkey
ETL tool connects unattendedKey-pair on a service user
Rotate a service credential without downtimeAdd or rotate the key pair, then switch the client
Block service users from passwordsAuthentication policy with KEYPAIR only

Common mistakes

Asking MFA of a service user. Service users cannot use MFA. Use key-pair, OAuth or a token.

Removing SNOWFLAKE_UI while requiring enrollment. Users enroll in Snowsight and would be stuck.

Rotating by overwriting the only key. Use the second key slot or the rotate command so there is a window where both work.

Leaving the private key unencrypted in a shared location. Encrypt it and protect it like a password.

What to remember for the exam

  • MFA methods: passkey, authenticator app (TOTP) and Duo; MFA_ENROLLMENT and MFA_POLICY live in an authentication policy.
  • MINS_TO_BYPASS_MFA gives a locked out user temporary single factor access.
  • ALLOW_CLIENT_MFA_CACHING caches an MFA token for up to four hours.
  • Key-pair needs RSA of at least 2048 bits, and the user can hold two public keys for rotation.
  • A rotated named key stays valid for 24 hours by default.

Check yourself

  • How can an application rotate a service user's key with no downtime?

    Add the new public key in the second slot (or use ROTATE KEY PAIR), switch the client to the new private key, then remove or let the old key expire.

  • A user lost their phone and cannot sign in with MFA. What gives temporary access?

    An administrator sets MINS_TO_BYPASS_MFA on the user, or issues one-time passcodes with ADD MFA METHOD OTP.

  • Which authentication fits a nightly ETL job that has no human to answer prompts?

    Key-pair authentication on a service user, optionally enforced with an authentication policy that allows only KEYPAIR.

Topic 17 of 17 in Accounts and Security

Test yourself on Accounts and Security

The full Snowflake ARA-C01 question bank has 687 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Snowflake. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.