Snowflake Security, RBAC, and User Administration · Topic 16 of 16

Exfiltration Controls, Service Authentication and AI Access

Stop data leaving through stages, set up service users with key pair and token authentication, and control access to Cortex AI features and models.

  • 5 min
In a nutshell
  • PREVENT_UNLOAD_TO_INLINE_URL and REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_CREATION default to FALSE and are set at account level.
  • Service users: TYPE = SERVICE, no password; key pair needs RSA 2048 bits or more.
  • PAT defaults: 15 days, maximum 365; shown once; service users need a network policy.

What it is

Three administrator jobs sit together here. First, exfiltration prevention: account parameters that stop people from copying data to storage you do not control. Second, service authentication: non-human users that connect with keys or tokens instead of passwords. Third, AI access control: deciding which roles can call Snowflake Cortex AI functions and which models they may use.

Unload or stageinline URL or ad hoc stageblocked byAccount parametersexfiltration controlsandService userskey pair or tokenandRole based AI access

How it works

Data exfiltration parameters

Both parameters are account level and are set by ACCOUNTADMIN.

ParameterWhen TRUE
PREVENT_UNLOAD_TO_INLINE_URLCOPY INTO <location> cannot unload to an external location given as a URL in the statement
REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_CREATIONAn external stage cannot be created without a storage integration

Their defaults are FALSE. A related parameter, REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_OPERATION, requires a storage integration when an external stage is used to load or unload.

ALTER ACCOUNT SET PREVENT_UNLOAD_TO_INLINE_URL = TRUE;
ALTER ACCOUNT SET REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_CREATION = TRUE;
ALTER ACCOUNT SET REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_OPERATION = TRUE;

Why they work together: a storage integration is an object an administrator creates and grants. With the two parameters on, users cannot unload to an arbitrary URL, and they cannot create a stage that points at a bucket the administrator never approved. Data can then leave only through approved integrations.

Watch out

Turning these on can break existing jobs that unload to URLs or use stages created with embedded credentials. Review the current stages first.

Service users and key pair authentication

A user has a TYPE: PERSON (default), SERVICE or LEGACY_SERVICE. A SERVICE user is made for applications and pipelines. It cannot sign in with a password, so it uses a key pair, a programmatic access token or workload identity federation.

CREATE USER svc_etl TYPE = SERVICE DEFAULT_ROLE = etl_role;
ALTER USER svc_etl SET RSA_PUBLIC_KEY = 'MIIBIjANBgkqh...';
DESC USER svc_etl;   -- RSA_PUBLIC_KEY_FP shows the fingerprint

Facts about key pair authentication:

  • The key is RSA, at least 2048 bits, in PEM format; the private key can be encrypted with a passphrase that is never sent to Snowflake.
  • To assign a public key you need OWNERSHIP on the user or the MODIFY PROGRAMMATIC AUTHENTICATION METHODS privilege on it.
  • Rotation with the classic properties uses two slots, RSA_PUBLIC_KEY and RSA_PUBLIC_KEY_2: set the unused slot, switch the client, then UNSET the old one.
  • Snowflake also recommends named key pairs (ALTER USER ... ADD KEY PAIR), which support role restriction and expiration, and ROTATE KEY PAIR, which keeps the old key valid for 24 hours by default.

Programmatic access tokens (PATs) are the token option:

ItemDetail
CreateALTER USER <user> ADD PROGRAMMATIC ACCESS TOKEN <name>
RoleROLE_RESTRICTION fixes the role for the token; required for service users
LifetimeDefault 15 days, maximum 365 days, changeable in a PAT_POLICY
NetworkService users must be under a network policy to create or use a token
Rotate and revokeROTATE PROGRAMMATIC ACCESS TOKEN and REMOVE PROGRAMMATIC ACCESS TOKEN

The token secret is shown only once, when it is created or rotated.

API integration and automated authentication

Automation reaches Snowflake through the SQL API, drivers or OAuth. For an identity provider to issue tokens, an administrator creates a security integration (for example External OAuth or Snowflake OAuth). The choice is a trade-off: OAuth fits tools that act for a person, while key pair, workload identity federation and PATs fit unattended jobs. Whatever the choice, give the service user a least-privilege default role and a network policy.

Service userTYPE SERVICEholdsPublic key or tokenused byPipelineJWT or PATlimited byRole and network policy

Access to AI features and models

Calling Cortex AI functions needs two things together: the USE AI FUNCTIONS account privilege (or a per-function privilege such as USE AI FUNCTION AI_COMPLETE) and one of the database roles SNOWFLAKE.CORTEX_USER or SNOWFLAKE.AI_FUNCTIONS_USER.

ItemDefault
USE AI FUNCTIONSGranted to PUBLIC
CORTEX_USER database roleGranted to PUBLIC
AI_FUNCTIONS_USER database roleNot granted to PUBLIC; covers scalar AI functions only
CORTEX_EMBED_USER database roleNot granted to PUBLIC; covers embedding functions

To lock access down, revoke from PUBLIC and grant to a custom role:

REVOKE USE AI FUNCTIONS ON ACCOUNT FROM ROLE PUBLIC;
REVOKE DATABASE ROLE SNOWFLAKE.CORTEX_USER FROM ROLE PUBLIC;
GRANT USE AI FUNCTIONS ON ACCOUNT TO ROLE ai_users;
GRANT DATABASE ROLE SNOWFLAKE.CORTEX_USER TO ROLE ai_users;

Model access is separate. The recommended method is role-based: application roles in the SNOWFLAKE database such as CORTEX-MODEL-ROLE-ALL or one for a single model are granted to account roles. The older account parameter CORTEX_MODELS_ALLOWLIST is being deprecated. Cross-region inference is governed by CORTEX_ENABLED_CROSS_REGION. Model access controls apply to the model, not the feature, so a role still needs the privilege and database role.

Common mistakes

Setting only one exfiltration parameter. Blocking inline URLs does not stop someone from creating a stage on an unapproved bucket.

Giving service users passwords. TYPE = SERVICE users should use keys or tokens.

Revoking only one of the two. Access needs both the privilege and a database role, but a role with USE AI FUNCTIONS and no CORTEX_USER can still call AI_AGG and AI_SUMMARIZE_AGG. Revoke from PUBLIC deliberately and check with SHOW GRANTS.

Forgetting the network policy for PATs. A service user without a network policy cannot generate or use a token.

What to remember for the exam

  • PREVENT_UNLOAD_TO_INLINE_URL and REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_CREATION default to FALSE and are set at account level.
  • Service users: TYPE = SERVICE, no password; key pair needs RSA 2048 bits or more.
  • PAT defaults: 15 days, maximum 365; shown once; service users need a network policy.
  • Cortex needs USE AI FUNCTIONS plus a database role; both are granted to PUBLIC by default except AI_FUNCTIONS_USER.
  • Model access is by application roles (recommended) rather than CORTEX_MODELS_ALLOWLIST.

Check yourself

  • Which two parameters ensure data can leave only through approved storage integrations?

    PREVENT_UNLOAD_TO_INLINE_URL and REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_CREATION, both set to TRUE.

  • How does a service user authenticate without a password?

    With a key pair (JWT), a programmatic access token or workload identity federation.

  • How do you limit Cortex AI function use to one team?

    Revoke the privilege and database role from PUBLIC, then grant them to a role for that team.

Topic 16 of 16 in Snowflake Security, RBAC, and User Administration

Test yourself on Snowflake Security, RBAC, and User Administration

The full Snowflake ADA-C02 question bank has 814 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.