Snowflake Gen AI Governance · Topic 7 of 15

Cortex Database Roles - CORTEX_USER, CORTEX_ANALYST_USER, CORTEX_AGENT_USER and CORTEX_EMBED_USER

Compare CORTEX_USER, CORTEX_ANALYST_USER, CORTEX_AGENT_USER, CORTEX_EMBED_USER and AI_FUNCTIONS_USER: scope, PUBLIC defaults and how to restrict them.

  • 5 min
  • Includes a diagram
In a nutshell
  • CORTEX_USER is the broad role and is on PUBLIC by default; the other four are not.
  • CORTEX_ANALYST_USER is Analyst only; CORTEX_AGENT_USER is Agents and Snowflake Intelligence only.
  • CORTEX_EMBED_USER covers embeddings and search services with managed embeddings.

What it is

Snowflake ships several database roles in the shared SNOWFLAKE database. Each one switches on a slice of Cortex. The exam asks you to pick the narrowest role that fits a job and to know which roles PUBLIC already holds.

Database roles cannot be granted directly to users. You grant them to an account role, and users get that role. They are separate from the USE AI FUNCTIONS account privilege, which AI functions also need.

SNOWFLAKE databasedatabase rolesgranted toCustom roleteam rolegranted toUsers

How it works

The roles side by side

Database roleCoversGranted to PUBLIC by default
SNOWFLAKE.CORTEX_USERAll covered AI features: AI functions, Cortex Agents, Cortex Analyst, Search and moreYes
SNOWFLAKE.CORTEX_ANALYST_USERCortex Analyst onlyNo
SNOWFLAKE.CORTEX_AGENT_USERCortex Agents API and Snowflake Intelligence onlyNo
SNOWFLAKE.CORTEX_EMBED_USEREmbedding functions and creating Cortex Search services with managed embeddingsNo
SNOWFLAKE.AI_FUNCTIONS_USERScalar AI functions onlyNo

CORTEX_USER

The broad role. Because it is granted to PUBLIC, every user in a new account can already use covered AI features. To restrict, revoke it from PUBLIC and from any role that holds it, then grant narrower roles.

REVOKE DATABASE ROLE SNOWFLAKE.CORTEX_USER FROM ROLE PUBLIC;
REVOKE IMPORTED PRIVILEGES ON DATABASE SNOWFLAKE FROM ROLE PUBLIC;

A user with USE AI FUNCTIONS but without CORTEX_USER can still call AI_AGG and AI_SUMMARIZE_AGG.

CORTEX_ANALYST_USER

Grants access to Cortex Analyst and nothing else. Use it for business users who ask questions of semantic views but should not call AI_COMPLETE. It is also required when an agent uses an Analyst tool: CORTEX_AGENT_USER does not include it.

USE ROLE ACCOUNTADMIN;
CREATE ROLE cortex_analyst_user_role;
GRANT DATABASE ROLE SNOWFLAKE.CORTEX_ANALYST_USER TO ROLE cortex_analyst_user_role;
GRANT ROLE cortex_analyst_user_role TO USER example_user;

To remove the broader access from an existing role: REVOKE DATABASE ROLE SNOWFLAKE.CORTEX_USER FROM ROLE analyst;.

CORTEX_AGENT_USER

Grants access to the Cortex Agents API and to Snowflake Intelligence, and no other covered feature. It does not include Analyst, so an agent with an Analyst tool needs CORTEX_ANALYST_USER too. A role that also holds CORTEX_USER keeps access to everything, so revoke CORTEX_USER to make the restriction real.

GRANT DATABASE ROLE SNOWFLAKE.CORTEX_AGENT_USER TO ROLE cortex_agent_user_role;

CORTEX_EMBED_USER

Covers AI_EMBED, the older EMBED_TEXT_768 and EMBED_TEXT_1024, and creating Cortex Search services with managed embeddings. It is not granted to PUBLIC. A role that builds search indexes but should not run LLM prompts is the textbook fit.

AI_FUNCTIONS_USER

Covers scalar AI functions only: not AI_AGG, not AI_SUMMARIZE_AGG, not Agents, Analyst, fine-tuning or Search. It is not granted to PUBLIC.

Choosing the role

NeedRole
Run any AI function, agents, analystCORTEX_USER
Only ask questions through Cortex AnalystCORTEX_ANALYST_USER
Only use agents and Snowflake IntelligenceCORTEX_AGENT_USER (plus ANALYST_USER for Analyst tools)
Build search services with embeddingsCORTEX_EMBED_USER
Only scalar AI functionsAI_FUNCTIONS_USER
Needonly AnalystpickCORTEX_ANALYST_USERand firstRevokeCORTEX_USER from PUBLIC
Watch out

Granting a narrow role without revoking CORTEX_USER from PUBLIC does not restrict anything, because PUBLIC already allows everything.

Putting the roles into a design

Least privilege layout after revoking CORTEX_USER from PUBLIC: business users, analysts, platform team and everyone else each get different database roles, and object privileges are still needed. Consider a company with four groups: business users who chat with a data agent, analysts who also run SQL AI functions, a platform team that builds search services, and everyone else who should have no Gen AI access. A least-privilege layout looks like this.

GroupAccount roleDatabase roles granted
Business usersagent_usersCORTEX_AGENT_USER and CORTEX_ANALYST_USER (the agent has an Analyst tool)
Analystsai_analystsCORTEX_USER
Platform teamsearch_buildersCORTEX_EMBED_USER
Everyone elsePUBLICNone, after the revokes

The first step is always the revoke: take SNOWFLAKE.CORTEX_USER away from PUBLIC (and the USE AI FUNCTIONS privilege if scalar functions must be limited too). Then grant by group. Remember that object privileges are still needed on top of the database roles, such as USAGE on the agent or the search service.

Roles and the account privilege together

For scalar SQL AI functions the check has two parts that are both required: the USE AI FUNCTIONS account privilege (or a per-function privilege) and a database role that covers the function. Revoking only one of them is enough to block a user (AI_AGG and AI_SUMMARIZE_AGG are the exception noted above), which is useful when you want to keep CORTEX_USER on a role for Search but stop it calling scalar AI functions.

Common mistakes

Assuming CORTEX_AGENT_USER covers Analyst tools. It does not; add CORTEX_ANALYST_USER.

Granting narrow roles but leaving CORTEX_USER on PUBLIC. Nothing is restricted.

Granting database roles to users. They go to roles.

Using CORTEX_USER for a search builder. CORTEX_EMBED_USER is the narrower fit, and a Search creator needs CORTEX_USER or CORTEX_EMBED_USER.

Thinking CORTEX_EMBED_USER is on PUBLIC. Only CORTEX_USER is, with USE AI FUNCTIONS.

What to remember for the exam

  • CORTEX_USER is the broad role and is on PUBLIC by default; the other four are not.
  • CORTEX_ANALYST_USER is Analyst only; CORTEX_AGENT_USER is Agents and Snowflake Intelligence only.
  • CORTEX_EMBED_USER covers embeddings and search services with managed embeddings.
  • To restrict, revoke CORTEX_USER everywhere first.

Check yourself

  • Which role would you give a team that only chats with agents?

    SNOWFLAKE.CORTEX_AGENT_USER, after revoking CORTEX_USER.

  • An agent uses an Analyst tool and fails for a user holding CORTEX_AGENT_USER. What is missing?

    CORTEX_ANALYST_USER, because CORTEX_AGENT_USER does not include Analyst.

  • Which database roles are on PUBLIC by default?

    Only SNOWFLAKE.CORTEX_USER, alongside the USE AI FUNCTIONS privilege.

Topic 7 of 15 in Snowflake Gen AI Governance

Test yourself on Snowflake Gen AI Governance

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