AWS outlines 3 ways an AI agent can sign in to Snowflake: as an individual user or through a shared account
When an AI agent in Amazon Bedrock AgentCore queries Snowflake, you have to decide whether it signs in as an individual employee or as a shared account. AWS tested three OAuth schemes: direct login to Snowflake, corporate SSO (Okta, Entra ID) and a shared service user. In the first two, the QUERY_HISTORY log shows the actual person and their role. In the third, it shows a single shared account. For auditing, choose one of the first two and keep the third for background tasks.
AI-processed from AWS Machine Learning Blog; edited by Hamidun News
Imagine you have connected an AI agent to your corporate Snowflake warehouse, and it answers analysts' questions about the data. One question comes up immediately: whose account does it use to access the database? The simplest route is a single service account with broad permissions.
But then every query looks the same in the log, and the agent can see more than any individual employee. AWS has published a breakdown of three OAuth authorization schemes for combining Amazon Bedrock AgentCore with the Snowflake MCP server (MCP is the Model Context Protocol, the standard an agent uses to discover and call tools). Through this server, agents get access to Cortex Search and Cortex Analyst.
If you are rolling out agents at your company, the article can help you pick the scheme that fits your audit and security requirements.
Who issues the pass: three schemes
The agent runs in AgentCore Runtime and connects to Snowflake through AgentCore Gateway. AgentCore Identity handles the tokens: it stores them in a secure vault, refreshes them and ties them to the user. The token path is the same in all schemes. The only differences are which authorization server issues the token and which login type (grant) it uses.
The first scheme is Snowflake OAuth. Snowflake itself acts as the authorization server, so no external identity provider (IdP) is needed. The user signs in to Snowflake directly via three-legged OAuth (3LO) and consents to work under a specific role, for example ANALYST_ROLE. All queries run on the user's behalf, and QUERY_HISTORY records the person's real name.
The second scheme is the same three-legged login, but through corporate single sign-on (SSO) in Okta or Microsoft Entra ID. Snowflake trusts the JWT tokens issued by the IdP through an External OAuth security integration. Queries again run as the real user with an assigned role.
The third scheme is two-legged OAuth (2LO) with a shared service user. The human confirms nothing, so the scheme suits background machine-to-machine tasks. However, in Snowflake all queries come from a single service account. For personal identity without a consent screen, AgentCore Identity also supports the on-behalf-of grant (TOKEN_EXCHANGE), but the authors did not test it end to end.
How it works, using the first scheme as an example
An analyst asks the agent to query Snowflake for the first time. Gateway checks the AgentCore Identity token vault and finds no token for this user. It then returns a JSON-RPC error with code -32042 and an authorization link. The client opens the link in a browser, the user sees the Snowflake login screen and confirms access under a specific role. After that, the access and refresh tokens are cached, and subsequent calls go through without another login.
Where it is easy to trip up:
- The setup order is not obvious. First, you create a CustomOauth2 credential provider with placeholder values to obtain the callbackUrl. Then you register that URL in Snowflake as a redirect URI in an integration with TYPE = OAUTH, OAUTH_CLIENT = CUSTOM. Only after that do you enter the real client ID and secret.
- Role selection at the consent step is not enabled by default: the server advertises session:role:all and falls back to DEFAULT_ROLE. You can narrow the scope via OAUTH_SCOPES_SUPPORTED and restrict the permitted roles via ALLOWED_ROLES_LIST. PRE_AUTHORIZED_ROLES_LIST, by contrast, lists the roles for which consent is skipped.
- Role names in the request must be uppercase, for example session:role:ANALYST_ROLE.
- If you bind the MCP scope to an external IdP via OAUTH_AUTHORIZATION_SERVER (the second scheme), Snowflake OAuth tokens are rejected there, with no fallback to the other scheme. If you need both schemes in one account, set the parameter at the schema or database level.
What to choose
If your employees already have Snowflake accounts and you need a quick pilot with per-user auditing, choose the first scheme: it needs no external provider. If your company already runs SSO, the second scheme fits the agent into your existing user management. The third suits automated tasks where simplicity matters more than tying actions to a person, and the service account's permissions should be cut to the minimum.
There are limitations. The schemes were tested only with the Snowflake-managed MCP server and the Okta and Microsoft Entra ID providers. Schemes 2 and 3 follow standard OAuth flows and may work with other OAuth-protected MCP servers, but you need to verify claims, scopes and audience for each specific SaaS provider. Only scheme 1 is specific to Snowflake, because it relies on Snowflake's built-in authorization server.
- Nov 19, 2026Amazon and Google's Anthropic Stakes Valued at $308 Billion in IPO at $83 a Share
- Nov 19, 2026AWS AgentCore Agents Can Now Reach a Private Keycloak Behind a Corporate CA
- Nov 19, 2026Nvidia posts record $115.8 billion revenue, yet trades cheaper than at any point since 2012
- Nov 19, 2026AWS: A Chain of 10 Agents at 95% Reliability Each Succeeds Only 59.9% of the Time
Key Questions Answered
Who issues the pass: three schemes?
The agent runs in AgentCore Runtime and connects to Snowflake through AgentCore Gateway. AgentCore Identity handles the tokens: it stores them in a secure vault, refreshes them and ties them to the user. The token path is the same in all schemes. The only differences are which authorization server issues the token and which login type (grant) it uses. The first scheme is Snowflake OAuth. Snowflake itself acts as the authorization server, so no external identity provider (IdP) is needed.
How it works, using the first scheme as an example?
An analyst asks the agent to query Snowflake for the first time. Gateway checks the AgentCore Identity token vault and finds no token for this user. It then returns a JSON-RPC error with code -32042 and an authorization link. The client opens the link in a browser, the user sees the Snowflake login screen and confirms access under a specific role. After that, the access and refresh tokens are cached, and subsequent calls go through without another login. Where it is easy to trip up: The setup order is not obvious.
What to choose?
If your employees already have Snowflake accounts and you need a quick pilot with per-user auditing, choose the first scheme: it needs no external provider. If your company already runs SSO, the second scheme fits the agent into your existing user management. The third suits automated tasks where simplicity matters more than tying actions to a person, and the service account's permissions should be cut to the minimum. There are limitations.
Build & Ship Production AI Agents Without Boilerplate Code
Start your free 72-hour trial at Hamidun Academy (academy.hamidun.com) — interactive lessons on Claude Code & Cursor, live Tech Radar, and production agent templates.
The AI world, distilled — once a week
Seven stories that actually mattered, hand-picked. No noise, no reposts, no press releases.
Done! Check your inbox for a confirmation.