News

AWS compares three ways AgentCore agents can authenticate to Snowflake via MCP

Published 3 min readAI-assisted · human approved
TL;DR

On 17 November AWS published a how-to covering three OAuth setups for AgentCore Gateway to reach Snowflake's managed MCP server: Snowflake OAuth, 3-legged OAuth with an external IdP, and 2-legged OAuth with a shared service user.

Why it matters

The auth pattern you pick decides whether Snowflake queries run as the real user or as one shared service account. The post also flags an issuer-lock behavior that can cause rejected tokens when two patterns share an account.

Image from AWS Machine Learning Blog
Image: AWS Machine Learning Blog. It belongs to its owner; see our image policy.

Original source

AWS published a technical how-to on 17 November 2026 describing three OAuth configurations for agents on Amazon Bedrock AgentCore that connect to Snowflake's managed MCP server. The authors say they tested the setups on AgentCore Identity, using Okta and Microsoft Entra ID.

This is AWS's own guidance, so its trade-off assessments are the vendor's view. The details below come from the AWS Machine Learning Blog post.

What happened

The post tackles one question: when an agent on AgentCore reaches Snowflake through the Model Context Protocol (MCP), how does it authenticate? Snowflake's MCP server surfaces Cortex Agents as one tool type, and the authors want enterprises to carry existing authentication and authorization controls into the agent layer instead of relying on broad service-account permissions or custom auth code.

In the reference design, AgentCore Gateway links the agent to the Snowflake MCP target and lists Cortex Search and Cortex Analyst tools in a single tools/list response. For outbound auth, AgentCore Identity acts as the credential broker. The Gateway gets a workload token through GetWorkloadAccessTokenForJWT, because it uses JWT inbound authentication, then calls GetResourceOauth2Token against the configured provider. AgentCore Identity owns the token vault, refresh and user-to-token binding.

The three patterns

Pattern Grant Credential provider in AgentCore Identity Queries run as
1. Snowflake OAuth (3LO) authorization_code CustomOauth2 The real user, with their assigned role
2. 3LO with external IdP authorization_code Built-in, such as OktaOauth2 or MicrosoftOauth2 The real user, with their assigned role
3. 2LO with external IdP client_credentials Built-in, or CustomOauth2 A shared Snowflake service user

On the Snowflake side, Pattern 1 uses a security integration with TYPE = OAUTH and OAUTH_CLIENT = CUSTOM. Patterns 2 and 3 use TYPE = EXTERNAL_OAUTH together with OAUTH_AUTHORIZATION_SERVER.

Key details

  • Per-user vs shared identity: Patterns 1 and 2 record the real user in Snowflake. The two-legged pattern needs no user interaction or consent, which suits machine-to-machine workloads, but queries run as one shared service user.
  • Role consent in Pattern 1: Per-role consent is not the default. The MCP server advertises session:role:all and falls back to DEFAULT_ROLE. The post says to narrow the advertised scope with OAUTH_SCOPES_SUPPORTED and to restrict ALLOWED_ROLES_LIST on the integration. PRE_AUTHORIZED_ROLES_LIST does the opposite: it names roles that skip the consent step.
  • Issuer-lock pitfall: If you set OAUTH_AUTHORIZATION_SERVER to lock an MCP scope to an external IdP, Snowflake OAuth tokens (Pattern 1) are rejected for MCP servers in that scope, with no fallback. To use both in one account, set the parameter per schema or database.
  • Portability: The external-IdP patterns follow standard OAuth flows, so the authors say they can extend to other OAuth-protected MCP servers, though token claims, scopes and audience should be validated for each provider. Only Pattern 1 is Snowflake-specific.
  • Other options: AgentCore Identity also offers an API-key provider, which supports Snowflake Programmatic Access Tokens, and an on-behalf-of grant (TOKEN_EXCHANGE) that gives per-user identity to unattended workloads without a consent prompt. The post concentrates on the three setups it tested end to end.
  • Reference agent: The sample combines a Strands agent on AgentCore Runtime, Amazon Bedrock Guardrails for PII redaction, and Bedrock Knowledge Bases over policy documents in Amazon S3.

Why it matters

The decision is mostly about attribution and blast radius. If auditors need to know which person's request triggered a query, the post says the per-user patterns record that identity in Snowflake QUERY_HISTORY. A scheduled or background agent with no user present maps more naturally to the shared-service-user pattern, or to the on-behalf-of option the authors mention but did not test here.

Teams already wiring agents to data over MCP, such as in this serverless MCP server for data lake access on ECS Fargate, should settle the identity model before fixing the gateway layout. The issuer-lock behavior is the detail most likely to produce a confusing rejected-token error in a mixed setup.

Checked claims

ClaimStatusEvidence
AgentCore Identity supports three OAuth configurations across two grant types.confirmedAmazon Bedrock AgentCore Identity supports three OAuth configurations spanning two grant types (authorization_code and client_credentials):
The two-legged pattern uses a shared service user via the IdP's client_credentials grant.confirmedA shared service user authenticates through the client_credentials grant of the IdP.
Issuer-locking an MCP scope to an external IdP causes Snowflake OAuth tokens to be rejected there, with no fallback.confirmedSnowflake OAuth tokens (Pattern 1) are rejected for MCP servers in that scope and do not fall back.
Per-role consent in the Snowflake OAuth pattern is not the default and must be configured.confirmedNote that per-role consent is not the default.
Only the Snowflake OAuth pattern is Snowflake-specific, per the authors.confirmedOnly Pattern 1 is Snowflake-specific
0
#agentcore#oauth#snowflake#mcp#agents

Found a mistake? Use Report above; an editor reads every one. Editorial policy

Question for readersWhen an agent in your stack queries a data warehouse, do you prefer per-user identity or a shared service account, and what drove that choice?

Discussion · 0

No comments yet. Start the discussion.

Sign in to join the discussion.