What you will be able to do
- Explain the two gates every Cortex AI function call must pass: the USE AI FUNCTIONS account privilege and a SNOWFLAKE database role
- Revoke the default PUBLIC grants and give AI function access to custom roles instead
- Restrict a role to named functions with per-function USE AI FUNCTION grants, and predict how they interact with the blanket privilege
- Choose between CORTEX_USER, AI_FUNCTIONS_USER and CORTEX_EMBED_USER for a given access requirement
Key concept
The two gates for Cortex AI functions — A Cortex AI function call succeeds only when the caller's roles hold an account-level privilege (USE AI FUNCTIONS, or a per-function USE AI FUNCTION grant for the named function) and also a SNOWFLAKE database role (CORTEX_USER or AI_FUNCTIONS_USER). Removing either one blocks the call.
1.Two gates on every AI function call
Functions such as AI_COMPLETE, AI_CLASSIFY and AI_EXTRACT send your data to a large language model and bill the account for every call. Who may run them is therefore a governance decision, and Snowflake controls it with two separate checks. The first is an account-level privilege, USE AI FUNCTIONS. The second is a database role in the shared SNOWFLAKE database: either SNOWFLAKE.CORTEX_USER or SNOWFLAKE.AI_FUNCTIONS_USER. A role needs one item from each gate before its users can call a Cortex AI function.
Both gates start open. USE AI FUNCTIONS and CORTEX_USER are each granted to the PUBLIC role by default, and PUBLIC is automatically granted to every user and every role. In a new account, then, anyone can call AI functions. Governance work here mostly means narrowing those defaults, and only ACCOUNTADMIN can manage the USE AI FUNCTIONS privilege.
The two gates are not perfectly symmetrical. A user who holds USE AI FUNCTIONS but no CORTEX_USER role can still run the aggregate functions AI_AGG and AI_SUMMARIZE_AGG. Taking away the database role therefore blocks most AI functions, but not those two. There is also one place where the privilege is not checked at all: AI function queries run inside a Snowflake native application succeed whether or not the role holds USE AI FUNCTIONS.
Checkpoint 1 of 7· Check yourself
An ACCOUNTADMIN revokes SNOWFLAKE.CORTEX_USER from PUBLIC but leaves USE AI FUNCTIONS granted to PUBLIC. No role has been granted CORTEX_USER or AI_FUNCTIONS_USER. What happens when an analyst calls Cortex AI functions?
A call needs both the account-level privilege and a Cortex database role, so taking away CORTEX_USER blocks most AI functions. The aggregate functions AI_AGG and AI_SUMMARIZE_AGG are the exception: they need only USE AI FUNCTIONS. A per-function grant satisfies only the privilege gate, so on its own it does not restore AI_COMPLETE.
“If a user has the USE AI FUNCTIONS account-level privilege but doesn’t have the CORTEX_USER role, they can still use the AI_AGG and AI_SUMMARIZE_AGG functions.”Source: docs.snowflake.com
Checkpoint 2 of 7· Exam question
Which account-level privilege, in addition to a Cortex database role, must a role hold for its users to invoke Snowflake Cortex AI functions at all?
Correct answer: A — USE AI FUNCTIONS
- A. This is correct: calling Cortex AI functions requires the account-level USE AI FUNCTIONS privilege (or a per-function equivalent) together with a Cortex database role such as CORTEX_USER.
- B. This is incorrect: a warehouse is only needed to run the query that invokes the function; it does not itself authorize access to Cortex functions.
- C. This is incorrect: this privilege only governs creating a search service object and is unrelated to calling scalar AI functions.
- D. This is incorrect: this administrative privilege lets a role manage grants on objects but grants no function-calling capability by itself.
Sources1
2.Revoking the PUBLIC defaults and granting to custom roles
To limit AI functions to chosen users, first take the defaults away from PUBLIC, then grant access to specific roles. For the privilege, ACCOUNTADMIN runs REVOKE USE AI FUNCTIONS ON ACCOUNT FROM ROLE PUBLIC;. For the database role, ACCOUNTADMIN runs REVOKE DATABASE ROLE SNOWFLAKE.CORTEX_USER FROM ROLE PUBLIC;. Access then goes back to the roles that should have it: GRANT USE AI FUNCTIONS ON ACCOUNT TO ROLE analyst; plus GRANT DATABASE ROLE SNOWFLAKE.CORTEX_USER TO ROLE analyst;. A single statement covers everyone who uses that role.
A database role cannot be granted directly to a user. GRANT DATABASE ROLE SNOWFLAKE.CORTEX_USER TO USER ... is not an option, so the pattern is always the same: create an account role, grant the database role to it, then grant the account role to users.
USE ROLE ACCOUNTADMIN;
CREATE ROLE cortex_user_role;
GRANT DATABASE ROLE SNOWFLAKE.CORTEX_USER TO ROLE cortex_user_role;
GRANT ROLE cortex_user_role TO USER some_user;Service code has one extra rule. When AI functions run under Restricted Caller's Rights, for example inside a Snowpark Container Services service, the privilege must be granted to both the session role and the service or application owner role. The owner role gets the caller form: GRANT CALLER USE AI FUNCTIONS ON ACCOUNT TO ROLE <service_owner_role>;.
Checkpoint 3 of 7· Fill the gap
An ACCOUNTADMIN is giving some_user access to Cortex AI functions through the CORTEX_USER database role. Which keyword belongs in the blank?
USE ROLE ACCOUNTADMIN;
CREATE ROLE cortex_user_role;
GRANT DATABASE ROLE SNOWFLAKE.CORTEX_USER TO ? cortex_user_role;
GRANT ROLE cortex_user_role TO USER some_user;You can't grant SNOWFLAKE.CORTEX_USER directly to a user. You grant it to an account role, and then you grant that account role to the user. That is why the database role goes TO ROLE cortex_user_role, and only the last statement names the user.
Source: docs.snowflake.com3.Per-function privileges and the OR rule
USE AI FUNCTIONS covers every Cortex AI function at once. For finer control, ACCOUNTADMIN can grant USE AI FUNCTION <name> for individual functions, such as AI_COMPLETE, AI_CLASSIFY, AI_EMBED or the legacy SNOWFLAKE.CORTEX.COMPLETE (privilege name COMPLETE). Grant several to the same role to build a custom set. Each per-function grant still needs the same database-role gate as the blanket privilege: CORTEX_USER or AI_FUNCTIONS_USER.
The blanket and per-function privileges combine with OR. A role that holds USE AI FUNCTIONS can call everything, and granting or revoking per-function privileges on it changes nothing. A role that holds only USE AI FUNCTION AI_COMPLETE can call only AI_COMPLETE. Because every role inherits PUBLIC, a per-function grant cannot restrict anything while PUBLIC still holds the blanket privilege. The working sequence is to revoke USE AI FUNCTIONS from PUBLIC, grant per-function privileges to the restricted role, and grant the blanket privilege back to the roles that should keep full access.
USE ROLE ACCOUNTADMIN;
-- Remove blanket access from PUBLIC
REVOKE USE AI FUNCTIONS ON ACCOUNT FROM ROLE PUBLIC;
-- Create a role with access to only AI_COMPLETE
CREATE ROLE ai_complete_user_role;
GRANT USE AI FUNCTION AI_COMPLETE ON ACCOUNT TO ROLE ai_complete_user_role;
GRANT DATABASE ROLE SNOWFLAKE.CORTEX_USER TO ROLE ai_complete_user_role;
GRANT ROLE ai_complete_user_role TO USER example_user;To take one function away, use REVOKE USE AI FUNCTION AI_COMPLETE ON ACCOUNT FROM ROLE ai_analyst_role;. To audit grants, run SHOW GRANTS TO ROLE ai_analyst_role; or SHOW GRANTS ON ACCOUNT;. Per-function grants appear there under names like USE AI FUNCTION AI_COMPLETE. These privileges control which functions a role may call. Which LLMs it may use is a separate control, covered under per-model RBAC and the model allowlist.
Checkpoint 4 of 7· Check yourself
USE AI FUNCTIONS has already been revoked from PUBLIC. Role ai_analyst_role holds SNOWFLAKE.CORTEX_USER, a direct grant of USE AI FUNCTIONS, and USE AI FUNCTION AI_COMPLETE. To block AI_COMPLETE for this role, ACCOUNTADMIN runs REVOKE USE AI FUNCTION AI_COMPLETE ON ACCOUNT FROM ROLE ai_analyst_role. What can the role call afterwards?
The blanket and per-function privileges combine with OR. A role that holds USE AI FUNCTIONS can call every function no matter which per-function grants it has or loses. To block AI_COMPLETE, revoke the blanket privilege and grant per-function privileges only for the functions the role should keep.
“If a role has USE AI FUNCTIONS, it can call all Cortex AI functions, regardless of any per-function grants or revocations.”Source: docs.snowflake.com
Checkpoint 5 of 7· Exam question
A team lead wants one role to be able to call AI_CLASSIFY but explicitly not AI_COMPLETE, while every other role in the account keeps its existing blanket access. Which approach achieves this without disturbing other roles?
Correct answer: B — Revoke USE AI FUNCTIONS ON ACCOUNT from PUBLIC and grant USE AI FUNCTION AI_CLASSIFY ON ACCOUNT to the role
- A. This is incorrect: because blanket and per-function privileges combine with OR logic, if the role or PUBLIC still holds the blanket privilege, AI_COMPLETE remains callable despite the narrower per-function grant.
- B. This is correct: since the account-wide privilege overrides per-function restrictions when present, PUBLIC's blanket grant must be revoked so that only the specific per-function grant defines what the role can call, isolating this change to that role's effective access.
- C. This is incorrect: CORTEX_USER is an all-or-nothing database role for covered AI features and has no mechanism to restrict access down to a single named function.
- D. This is incorrect: masking policies control visibility of stored column data and have no effect on whether a role is authorized to invoke a Cortex function directly.
Sources1
4.Narrower database roles: AI_FUNCTIONS_USER and CORTEX_EMBED_USER
CORTEX_USER is broad. It opens every Covered AI Feature, including Cortex Agents, Cortex Analyst and Cortex Search, as well as the functions. Two narrower SNOWFLAKE database roles can stand in for it when users need less.
AI_FUNCTIONS_USER covers the scalar Cortex AI functions only. That is every AI function except the aggregates AI_AGG and AI_SUMMARIZE_AGG, and it gives no access to Cortex Agent, Cortex Analyst, Cortex Fine-tuning or Cortex Search. Take business users who should keep calling AI_COMPLETE and AI_CLASSIFY from worksheets but must not build chat-with-data apps, run searches or fine-tune: AI_FUNCTIONS_USER, together with the USE AI FUNCTIONS privilege, is the exact fit. The feature-only roles CORTEX_AGENT_USER and CORTEX_ANALYST_USER work the other way round. They open a single service, not the functions.
CORTEX_EMBED_USER separates embedding from everything else. It allows AI_EMBED, EMBED_TEXT_768 and EMBED_TEXT_1024, and it allows creating Cortex Search services with managed vector embeddings. A Search service built on embeddings you generate outside Snowflake and load into a table does not need it. Neither narrow role is granted to PUBLIC by default. After you revoke CORTEX_USER from PUBLIC, users who still need these capabilities lose them until ACCOUNTADMIN grants the narrow role to an account role they can use. To give the capability to everyone instead, grant the narrow role to PUBLIC, for example GRANT DATABASE ROLE SNOWFLAKE.AI_FUNCTIONS_USER TO ROLE PUBLIC;.
| Database role | Granted to PUBLIC by default | What it unlocks |
|---|---|---|
| SNOWFLAKE.CORTEX_USER | Yes | All Cortex AI functions plus Cortex services such as Agents, Analyst and Search |
| SNOWFLAKE.AI_FUNCTIONS_USER | No | Scalar AI functions only: not AI_AGG or AI_SUMMARIZE_AGG, and no Cortex Agent, Analyst, Fine-tuning or Search |
| SNOWFLAKE.CORTEX_EMBED_USER | No | AI_EMBED, EMBED_TEXT_768, EMBED_TEXT_1024, and creating Cortex Search services with managed vector embeddings |
Checkpoint 6 of 7· Match them up
Match each SNOWFLAKE database role to what it unlocks, and whether PUBLIC holds it by default.
Tap a term, then the definition that fits it.
CORTEX_USER is the broad default that PUBLIC holds. AI_FUNCTIONS_USER and CORTEX_EMBED_USER are narrower, and an administrator must grant them explicitly to an account role. That matters most after CORTEX_USER is revoked from PUBLIC. The feature-only roles such as CORTEX_ANALYST_USER work the other way round: they open one service, not the functions.
“Unlike the CORTEX_USER role, the CORTEX_EMBED_USER role is not granted to the PUBLIC role by default.”Source: docs.snowflake.com
Checkpoint 7 of 7· Exam question
A governance team wants ordinary business users to keep calling AI_COMPLETE and AI_CLASSIFY through Snowsight worksheets without gaining any ability to build chat-with-data apps, run searches, or use fine-tuning. Which single database role satisfies this exactly?
Correct answer: A — SNOWFLAKE.AI_FUNCTIONS_USER
- A. This is correct: AI_FUNCTIONS_USER grants scalar AI functions such as completion and classification but deliberately excludes Cortex Analyst, Agents, Search, and fine-tuning, matching the narrow scope requested.
- B. This is incorrect: CORTEX_USER is the broad role that unlocks all covered Cortex AI features, which is more access than the team wants to grant.
- C. This is incorrect: this role authorizes calling Cortex Agents specifically and has no bearing on plain scalar function access.
- D. This is incorrect: this role authorizes Cortex Analyst requests only and would not by itself cover general scalar function calls.
Sources1
Sources
(2)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“one of the CORTEX_USER or AI_FUNCTIONS_USER database roles to use Snowflake Cortex AI Functions”
↩︎ Two gates on every AI function call“By default, the USE AI FUNCTIONS privilege is granted to the PUBLIC role.”
↩︎ Two gates on every AI function call“You must use the ACCOUNTADMIN role to manage the USE AI FUNCTIONS account-level privilege.”
↩︎ Two gates on every AI function call“they can still use the AI_AGG and AI_SUMMARIZE_AGG functions”
↩︎ Two gates on every AI function call“Currently, USE AI FUNCTIONS does not apply to AI Function queries that are run inside Snowflake native applications.”
↩︎ Two gates on every AI function call“The SNOWFLAKE.CORTEX_USER database role cannot be granted directly to a user.”
↩︎ Revoking the PUBLIC defaults and granting to custom roles“The PUBLIC role is automatically granted to all users and roles”
↩︎ Revoking the PUBLIC defaults and granting to custom roles“to both the session role and the service or application owner role”
↩︎ Revoking the PUBLIC defaults and granting to custom roles“If a role has USE AI FUNCTIONS, it can call all Cortex AI functions, regardless of any per-function grants or revocations.”
↩︎ Per-function privileges and the OR rule“Per-function privileges require the same CORTEX_USER (or AI_FUNCTIONS_USER) database role as the blanket USE AI FUNCTIONS privilege.”
↩︎ Per-function privileges and the OR rule“without granting access to Cortex services such as Cortex Agent, Cortex Analyst, Cortex Fine-tuning, or Cortex Search”
↩︎ Narrower database roles: AI_FUNCTIONS_USER and CORTEX_EMBED_USER“AI_FUNCTIONS_USER role is not granted to the PUBLIC role by default.”
↩︎ Narrower database roles: AI_FUNCTIONS_USER and CORTEX_EMBED_USER“CORTEX_EMBED_USER allows you to grant embedding privileges separately from other Cortex AI capabilities.”
↩︎ Narrower database roles: AI_FUNCTIONS_USER and CORTEX_EMBED_USER“You can create Cortex Search Services with user-provided embeddings without the CORTEX_EMBED_USER role.”
↩︎ Narrower database roles: AI_FUNCTIONS_USER and CORTEX_EMBED_USER“Your users need both the USE AI FUNCTIONS account-level privilege”
↩︎ Key concept“If a role has USE AI FUNCTIONS, it can call all Cortex AI functions, regardless of any per-function grants or revocations.”
↩︎ Exam trap 1“Per-function privileges require the same CORTEX_USER (or AI_FUNCTIONS_USER) database role as the blanket USE AI FUNCTIONS privilege.”
↩︎ Exam trap 2“Unlike the CORTEX_USER role, the CORTEX_EMBED_USER role is not granted to the PUBLIC role by default.”
↩︎ Exam trap 3“If a user has the USE AI FUNCTIONS account-level privilege but doesn’t have the CORTEX_USER role, they can still use the AI_AGG and AI_SUMMARIZE_AGG functions.”
↩︎ Checkpoint“Unlike the CORTEX_USER role, the CORTEX_EMBED_USER role is not granted to the PUBLIC role by default.”
↩︎ Checkpoint - 2.
“it also removes PUBLIC’s access to other objects in the shared SNOWFLAKE database, such as ACCOUNT_USAGE views”
↩︎ Revoking the PUBLIC defaults and granting to custom roles