2: Account Management and Data Governance

    Explain Snowflake security model and principles

    The Snowflake security model answers three operational questions at the same time: who can connect, who can act on which object, and how administrators prove what happened.

    Without a deliberate design across these three planes, an account either grants too little (and BI users wait on access tickets) or grants too much (and a marketing analyst can drop a finance schema). The Snowflake model is hybrid by design:

    • it combines Role-Based Access Control with Discretionary Access Control,
    • layers authentication factors in front of role assumption,
    • and constrains the network perimeter with Network Policies so a stolen credential outside an allow-list is useless.

    This section walks through each plane in the order an architect would design them: identity (authentication and identifiers), authorization (roles, privileges, hierarchy), perimeter (network), and observability (logging and tracing).

    How it works

    A practical mental model: when a user signs in, Snowflake first checks the account identifier and the user record, then runs the authentication factors that user is configured for, then validates the source IP against any Network Policy attached to the user or account, then activates a primary role (and optionally secondary roles) for the session.

    Every subsequent statement is authorized by intersecting the active role set with the privileges granted on the target object.

    The audit trail of each step lands in the ACCOUNT_USAGE and EVENT TABLE surfaces covered later in this chapter.

    Account identifiers

    Every Snowflake account is reachable by an account identifier that combines an organization name and an account name (the preferred form) or by a legacy locator that includes the cloud region and platform.

    The preferred form is organization_name-account_name, used in the host portion of the URL https://organization_name-account_name.snowflakecomputing.com.

    The legacy form is account_locator.region.cloud, for example xy12345.us-east-2.aws.

    Account identifiers are not secret, but pinning client tools and federation metadata to the preferred form lets administrators rename or relocate the account without breaking connection strings.

    The account identifier is also the key Snowflake uses to scope organization-level features such as replication groups, failover groups, and Snowflake Marketplace listings.

    The SYSTEM$ALLOWLIST function returns the set of hostnames and IP ranges a Snowflake account needs to reach outside the customer perimeter (for example, OCSP responders and Snowpipe ingest endpoints), and SYSTEM$WHITELIST_PRIVATELINK returns the equivalent for PrivateLink customers.

    Network and firewall planning starts from this output.

    -- Inspect the canonical account identifier
    SELECT CURRENT_ORGANIZATION_NAME(), CURRENT_ACCOUNT_NAME(), CURRENT_ACCOUNT();
    
    -- Pull the allow-list Snowflake recommends for outbound firewall rules
    SELECT VALUE:type::string AS endpoint_type,
     VALUE:host::string AS host,
     VALUE:port::number AS port
    FROM TABLE(FLATTEN(input => PARSE_JSON(SYSTEM$ALLOWLIST())));
    

    💡 Exam Trap: Questions that show a connection string with a legacy locator (for example xy12345.us-east-2.aws.snowflakecomputing.com) are often paired with a distractor that claims the form is invalid. Both the organization-account form and the locator form are valid; the organization-account form is the recommended one, and SAML metadata that pins the locator will break if Snowflake moves the account between regions.

    Role-Based Access Control (RBAC) and securable object hierarchy

    Key points

    In Snowflake, every securable object (account, warehouse, database, schema, table, view, function, stage, integration, share, application, and so on) has exactly one owning role at any time. The owning role holds the OWNERSHIP privilege, which carries the right to grant other privileges, drop the object, and transfer ownership. All other access is expressed as a privilege grant on the object to a role, and roles are granted to users or to other roles, forming a role hierarchy. A user activates one role at a time as the primary role for the session, and can optionally activate secondary roles to widen the union of privileges available within the session.

    Privileges flow up the role hierarchy. If role ACME_FINANCE_ANALYST is granted to role ACME_FINANCE_LEAD, every privilege held by the analyst role is exercisable by the lead role. By convention, custom roles are layered:

    • object-access roles at the bottom (read on a schema, write on a table)
    • functional roles in the middle (analyst, engineer, lead)
    • an administrator role above them all

    The administrator role is then granted to SYSADMIN, so the system-defined SYSADMIN role retains ownership and visibility over every workload-owned object.

    The securable object hierarchy is the lattice along which privileges are applied. From the top: Account, then Database (or Warehouse, Integration, Share, Network Policy, User, Role at the account level), then Schema, then schema-scoped objects such as Tables, Views, Stages, Functions, Procedures, Streams, Tasks, Sequences, File Formats, Pipes, Dynamic Tables, and Iceberg Tables. Privileges granted on a higher container do not automatically grant access on contained objects; the USAGE privilege on a database lets a role see that the database exists, but the role still needs USAGE on a schema and SELECT on a table to query data.

    System-defined roles

    Snowflake ships with a fixed set of system-defined roles that exist in every account: ORGADMIN, ACCOUNTADMIN, SECURITYADMIN, USERADMIN, SYSADMIN, and PUBLIC.

    • ORGADMIN manages the organization (creates accounts, enables features at the organization level, configures replication groups).
    • ACCOUNTADMIN encapsulates SECURITYADMIN and SYSADMIN; it is the only role that can view billing data, manage Resource Monitors at the account level, and set certain account parameters.
    • SECURITYADMIN can manage any grant globally (it has the MANAGE GRANTS privilege) and contains USERADMIN.
    • USERADMIN owns user and role creation.
    • SYSADMIN owns all warehouses and, by best practice, all custom databases.
    • PUBLIC is automatically granted to every user and role; granting privileges to PUBLIC effectively makes them universal.

    The system-defined roles are designed to be assigned to a small set of administrators only. Day-to-day workload roles should be custom roles granted up to SYSADMIN. Granting ACCOUNTADMIN to a workload service account is an anti-pattern that breaks both least privilege and the audit trail (every action shows up under one super-role).

    ⚠️ Anti-Pattern: Granting ACCOUNTADMIN to a service user used by Airflow, dbt, or any other automation. If the credential is exposed, the attacker holds the full account. Build a dedicated functional role with only the warehouse, database, schema, and integration privileges the automation requires, and grant that role to the service user as the default role.

    Functional roles: account roles, database roles, and custom roles

    A functional role is a custom role designed to represent a job function (data engineer, BI analyst, ML scientist) rather than a single object.

    Comparison

    Snowflake supports two scopes: account roles (the original kind) and database roles.

    • An account role is created with CREATE ROLE and exists at the account scope; it can be granted any privilege on any object in the account and can be granted to users or to other account roles.
    • A database role is created with CREATE DATABASE ROLE database_name.role_name, lives inside one database, and can only hold privileges on objects within that database.

    A database role can be granted to an account role (which can then be granted to users) and is the building block recommended for sharing privileges across replicated databases or across consumers of a share.

    -- Account role: spans the account
    USE ROLE USERADMIN;
    CREATE ROLE ACME_BI_READER;
    
    USE ROLE SECURITYADMIN;
    GRANT USAGE ON WAREHOUSE ACME_BI_WH TO ROLE ACME_BI_READER;
    GRANT USAGE ON DATABASE ACME_SALES TO ROLE ACME_BI_READER;
    GRANT USAGE ON ALL SCHEMAS IN DATABASE ACME_SALES TO ROLE ACME_BI_READER;
    GRANT SELECT ON ALL TABLES IN SCHEMA ACME_SALES.REPORTING TO ROLE ACME_BI_READER;
    GRANT SELECT ON FUTURE TABLES IN SCHEMA ACME_SALES.REPORTING TO ROLE ACME_BI_READER;
    GRANT ROLE ACME_BI_READER TO ROLE SYSADMIN;
    
    -- Database role: scoped to ACME_SALES
    USE ROLE SECURITYADMIN;
    CREATE DATABASE ROLE ACME_SALES.READ_REPORTING;
    GRANT USAGE ON SCHEMA ACME_SALES.REPORTING TO DATABASE ROLE ACME_SALES.READ_REPORTING;
    GRANT SELECT ON ALL TABLES IN SCHEMA ACME_SALES.REPORTING TO DATABASE ROLE ACME_SALES.READ_REPORTING;
    GRANT DATABASE ROLE ACME_SALES.READ_REPORTING TO ROLE ACME_BI_READER;
    

    FUTURE GRANTS apply privileges to objects that have not been created yet but match the grant pattern (for example, every future table created in a schema). This solves the operational problem of new tables landing without read access. Note that FUTURE GRANTS only apply to objects created after the grant; existing objects need an explicit GRANT.

    Discretionary access control (DAC)

    DAC is the second pillar of the Snowflake model: the owning role can grant or revoke privileges on objects it owns at its discretion.

    The OWNERSHIP privilege is what carries the discretion; without it, even SECURITYADMIN cannot grant SELECT on a table unless it first uses the MANAGE GRANTS privilege to act on behalf of the owner.

    This is why ownership transfer (GRANT OWNERSHIP ON ... TO ROLE ... REVOKE CURRENT GRANTS) is a sensitive operation: it moves both the asset and the right to redistribute access.

    Combined, RBAC and DAC produce a model where SECURITYADMIN can manage the grant graph, SYSADMIN owns workload objects (so SYSADMIN-rooted role chains pick up ownership-derived rights), and each application or team has its own delegated owner role for the objects it creates.

    The grant graph itself is queryable through SHOW GRANTS, the GRANTS_TO_ROLES, GRANTS_TO_USERS, and GRANTS_ON_OBJECTS views in ACCOUNT_USAGE.

    💡 Exam Trap: USAGE on a database does not imply USAGE on its schemas, and USAGE on a schema does not imply SELECT on its tables. Privileges are not inherited down the object hierarchy; they are inherited up the role hierarchy. Distractors frequently swap the two directions.

    Network Policies

    A Network Policy is a named object that defines an allowed list and an optional blocked list of IPv4 CIDR ranges, plus optionally a set of VPC IDs or VPCE IDs for AWS PrivateLink.

    Network Policies can be applied at the account level, the security integration level, or the user level.

    The most specific policy wins: a user-level policy overrides an account-level policy. The blocked list is evaluated first, then the allowed list.

    • If a request originates from an IP that matches the blocked list, the connection is rejected even if the IP also matches the allowed list.
    • If the source IP matches neither, the connection is rejected.
    • The intended use is corporate VPN egress ranges and PrivateLink endpoints in the allow-list and known-malicious or test-only ranges in the block-list.
    USE ROLE SECURITYADMIN;
    CREATE NETWORK POLICY ACME_CORP_VPN
     ALLOWED_IP_LIST = ('203.0.113.0/24','198.51.100.10/32')
     BLOCKED_IP_LIST = ('203.0.113.250/32')
     COMMENT = 'Corporate egress ranges';
    
    ALTER ACCOUNT SET NETWORK_POLICY = ACME_CORP_VPN;
    
    -- Override the account policy for a privileged break-glass user
    ALTER USER ACME_BREAKGLASS SET NETWORK_POLICY = ACME_OFFLINE_NETWORK_POLICY;
    

    📊 Limit: A Network Policy supports up to 1,000 IP entries across the ALLOWED_IP_LIST and BLOCKED_IP_LIST combined. Plan aggregation in CIDR notation before approaching the limit.

    Authentication

    Authentication is the per-session proof of identity. Snowflake supports several mechanisms, and most can be combined per user. The primary mechanisms are password-based authentication (with mandatory MFA enforcement available at the account level), Multi-Factor Authentication, Federated Authentication via SAML 2.0, OAuth (both Snowflake OAuth and External OAuth), and key-pair authentication.

    Multi-Factor Authentication (MFA)

    MFA in Snowflake is delivered through the Duo Security service that is embedded in every account at no extra cost. Users enroll a smartphone authenticator and receive push notifications, passcodes, or phone-call factors on each login.

    MFA can be enforced per user (ALTER USER ... SET MINS_TO_BYPASS_MFA = 0) and is a strong control for human users using password authentication.

    Snowflake also offers MFA caching to reduce push-notification fatigue for tools that connect frequently. The cache time is governed by the ALLOW_CLIENT_MFA_CACHING account parameter.

    Federated Authentication and Single Sign-on (SSO)

    Federated authentication uses SAML 2.0 to delegate user authentication to an external identity provider such as Okta, Microsoft Entra ID, or Ping Identity.

    The provider returns a signed SAML assertion containing the user's NameID; Snowflake matches NameID to the LOGIN_NAME of a user.

    SSO removes the password from the human's day-to-day workflow and centralizes MFA, conditional access, and offboarding in the identity provider.

    A SAML2 security integration is the Snowflake-side configuration that holds the provider's certificate, issuer URL, and SSO URL.

    USE ROLE ACCOUNTADMIN;
    CREATE SECURITY INTEGRATION ACME_OKTA
     TYPE = SAML2
     ENABLED = TRUE
     SAML2_ISSUER = 'http://www.okta.com/exk12345'
     SAML2_SSO_URL = 'https://acme.okta.com/app/snowflake/exk12345/sso/saml'
     SAML2_PROVIDER = 'OKTA'
     SAML2_X509_CERT = 'MIIDpDCCAoygAwIBAgIGAYr...'
     SAML2_SP_INITIATED_LOGIN_PAGE_LABEL = 'Okta SSO';
    

    OAuth

    OAuth lets a client obtain an access token on behalf of a user without holding the user's password. Snowflake supports two OAuth flavors.

    • Snowflake OAuth is built in; the account itself acts as the authorization server.
    • External OAuth delegates to an external authorization server such as Microsoft Entra ID, Okta, or PingFederate, and is the form used when applications already have OAuth tokens issued by the corporate identity provider and need to exchange them for Snowflake access.

    OAuth integrations bind to a role or to the role granted to the user; the token's scope determines what role can be activated.

    Key-pair authentication

    Key-pair authentication binds an RSA public key to a Snowflake user; the user (typically a service account or automation pipeline) holds the matching private key and signs a short JWT that Snowflake verifies.

    Key-pair authentication is the recommended mechanism for non-human users because it avoids long-lived passwords.

    Snowflake supports key rotation through RSA_PUBLIC_KEY and RSA_PUBLIC_KEY_2 slots, which lets a service rotate keys without downtime.

    # Generate a 2048-bit RSA private key (PKCS#8, unencrypted for illustration only)
    openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out acme_pipeline_key.p8 -nocrypt
    
    # Extract the public key
    openssl rsa -in acme_pipeline_key.p8 -pubout -out acme_pipeline_key.pub
    
    USE ROLE USERADMIN;
    ALTER USER ACME_PIPELINE_SVC SET RSA_PUBLIC_KEY='MIIBIjANBgkqhkiG9w0BAQEFAAOCA...';
    -- Stage a second key for zero-downtime rotation
    ALTER USER ACME_PIPELINE_SVC SET RSA_PUBLIC_KEY_2='MIIBIjANBgkqhkiG9w0BAQEFAAOCA...';
    

    Role hierarchy diagram

    The diagram below sketches a typical custom role hierarchy rooted at SYSADMIN and the parallel grant of administrative system roles.

    Decision Tree: Building a Role Hierarchy

    Secondary roles

    A primary role is the role explicitly activated for the session through USE ROLE or the default at login.

    Secondary roles let a session activate additional roles whose privileges are unioned with the primary role for the duration of the session.

    Setting USE SECONDARY ROLES ALL activates every role granted to the user, which is the typical configuration for human analysts who hold several functional roles.

    Setting USE SECONDARY ROLES NONE returns the session to primary-role-only behavior, which is the safer setting for service accounts that should not accidentally exercise unrelated privileges.

    Secondary roles only affect privilege checks against existing objects.

    Object creation (and the new object's owner) is always attributed to the primary role: CREATE TABLE runs as the primary role, and the owner becomes the primary role even if a secondary role also has CREATE TABLE privileges.

    This rule prevents object sprawl across owning roles and keeps ownership lineage deterministic.

    💡 Exam Trap: When asked which role owns a newly created object in a session with secondary roles active, the answer is the primary role at the moment of creation. Secondary roles influence what the session can do, not what it owns.

    Logging and tracing

    Snowflake records authentication and authorization events in account-level views and, for application code running inside Snowflake (Snowpark Python, Snowpark Scala, stored procedures, UDFs, and Streamlit in Snowflake apps), in event tables that capture logs, traces, and metrics.

    The SNOWFLAKE.ACCOUNT_USAGE.LOGIN_HISTORY view returns each authentication attempt with the user, reported client IP, authentication method, and error code (for failed attempts).

    The SESSIONS view ties session IDs to the authentication record.

    The ACCESS_HISTORY view records every read and write at the column level, which is the foundation for data lineage.

    An event table is a Snowflake table with a fixed schema (TIMESTAMP, OBSERVED_TIMESTAMP, TRACE, RESOURCE_ATTRIBUTES, RECORD_TYPE, RECORD_ATTRIBUTES, VALUE, and so on) that Snowflake auto-populates when handler code emits OpenTelemetry-compatible logs and traces.

    One event table is associated with the account through ALTER ACCOUNT SET EVENT_TABLE = ..., and per-database overrides are supported.

    USE ROLE ACCOUNTADMIN;
    CREATE DATABASE ACME_OBSERVABILITY;
    CREATE EVENT TABLE ACME_OBSERVABILITY.PUBLIC.MAIN_EVT;
    ALTER ACCOUNT SET EVENT_TABLE = ACME_OBSERVABILITY.PUBLIC.MAIN_EVT;
    
    -- Surface failed logins in the last 14 days
    SELECT EVENT_TIMESTAMP, USER_NAME, CLIENT_IP, ERROR_CODE, ERROR_MESSAGE
    FROM SNOWFLAKE.ACCOUNT_USAGE.LOGIN_HISTORY
    WHERE IS_SUCCESS = 'NO'
     AND EVENT_TIMESTAMP > DATEADD('day', -14, CURRENT_TIMESTAMP())
    ORDER BY EVENT_TIMESTAMP DESC;
    

    🎯 Scenario: A SOC analyst sees a spike of failed authentications from a single IP against several service users. The analyst joins LOGIN_HISTORY against USERS to identify the targeted users, confirms none belong to MFA-protected humans, and applies a tighter Network Policy at the user level for each service account. Because key-pair authentication is required for those service accounts, the spike is auto-rejected. The investigation closes without a credential rotation.

    📊 Limit: LOGIN_HISTORY retains records for 365 days in ACCOUNT_USAGE, with up to 45 minutes of latency. ACCESS_HISTORY retains records for 365 days with up to 3 hours of latency. For real-time alerting, route events through Snowflake Alerts on the event table rather than relying on ACCOUNT_USAGE.

    Decision Anchor

    Choose Federated Authentication with SAML 2.0 for human users when the organization already runs an identity provider with conditional access and centralized MFA.

    Choose key-pair authentication for service accounts and automation pipelines where rotating tokens through an OAuth flow is more complex than rotating the public key slot.

    Choose Snowflake OAuth when the consuming client supports OAuth natively but the identity provider is not federated.

    Choose External OAuth when the application already holds tokens from the corporate identity provider and needs to exchange them for Snowflake access. ---

    Continue with the interactive course

    Track your progress, jump into practice questions and use the Shark AI tutor inside the Snowflake - SnowPro Core learning hub.