CertSafari
    Snowflake SnowPro Specialty: Gen AI (GES-C02)· Lessons

    Domain 3 · Lesson 9/15

    Cortex AI function access: USE AI FUNCTIONS and CORTEX_USER

    Grant and revoke Role-Based Access Control (RBAC) and privileges.

    12 min read
    7.25% of exam
    2 sources
    Published 21 Oct 2026
    Docs as of 18 Oct 2026

    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?

    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?

    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.

    Granting CORTEX_USER to a user through a purpose-built account rolesql
    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;

    Sources12

    3.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.

    Removing blanket access from PUBLIC, then giving one role AI_COMPLETE onlysql
    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?

    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?

    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;.

    SNOWFLAKE database roles that satisfy the database-role gate for AI functions
    Database roleGranted to PUBLIC by defaultWhat it unlocks
    SNOWFLAKE.CORTEX_USERYesAll Cortex AI functions plus Cortex services such as Agents, Analyst and Search
    SNOWFLAKE.AI_FUNCTIONS_USERNoScalar AI functions only: not AI_AGG or AI_SUMMARIZE_AGG, and no Cortex Agent, Analyst, Fine-tuning or Search
    SNOWFLAKE.CORTEX_EMBED_USERNoAI_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.

    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?

    Sources1

    Sources

    (2)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 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. 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

    Continue to part 2 of 2

    Privileges for Cortex Analyst, Agents, Search and Snowflake Intelligence

    Spotted a mistake, or was something unclear? Tell us.