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
- 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.
How it works
The roles side by side
| Database role | Covers | Granted to PUBLIC by default |
|---|---|---|
SNOWFLAKE.CORTEX_USER | All covered AI features: AI functions, Cortex Agents, Cortex Analyst, Search and more | Yes |
SNOWFLAKE.CORTEX_ANALYST_USER | Cortex Analyst only | No |
SNOWFLAKE.CORTEX_AGENT_USER | Cortex Agents API and Snowflake Intelligence only | No |
SNOWFLAKE.CORTEX_EMBED_USER | Embedding functions and creating Cortex Search services with managed embeddings | No |
SNOWFLAKE.AI_FUNCTIONS_USER | Scalar AI functions only | No |
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
| Need | Role |
|---|---|
| Run any AI function, agents, analyst | CORTEX_USER |
| Only ask questions through Cortex Analyst | CORTEX_ANALYST_USER |
| Only use agents and Snowflake Intelligence | CORTEX_AGENT_USER (plus ANALYST_USER for Analyst tools) |
| Build search services with embeddings | CORTEX_EMBED_USER |
| Only scalar AI functions | AI_FUNCTIONS_USER |
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
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.
| Group | Account role | Database roles granted |
|---|---|---|
| Business users | agent_users | CORTEX_AGENT_USER and CORTEX_ANALYST_USER (the agent has an Analyst tool) |
| Analysts | ai_analysts | CORTEX_USER |
| Platform team | search_builders | CORTEX_EMBED_USER |
| Everyone else | PUBLIC | None, 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.