Thử nghiệm thực tế Nithyashree Alwarsamy
<p>Enterprises today need a clear way to extend their authentication and authorization controls into the agentic layer, often requiring either broad service account permissions or custom-built auth integrations that add operational overhead. When an AI agent running on <a href="https://aws.amazon.com/bedrock/agentcore/" target="_blank" rel="noopener">Amazon Bedrock AgentCore</a> (a platform to build, connect, and optimize agents at scale, with any framework or model) needs to call the <a href="https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-agents-mcp" target="_blank" rel="noopener">Snowflake-managed MCP server</a> (which exposes <a href="https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-agents" target="_blank" rel="noopener">Snowflake Cortex Agents</a> as one of its tool types) through the <a href="https://modelcontextprotocol.io/" target="_blank" rel="noopener">Model Context Protocol</a> (MCP), the first question enterprises must answer is: how does the agent authenticate? In this post, we walk through three Open Authorization (OAuth) configurations we tested on <a href="https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/identity.html" target="_blank" rel="noopener">Amazon Bedrock AgentCore Identity</a>, a capability of Amazon Bedrock AgentCore: Snowflake OAuth (per-user, no external Identity Provider, or IdP), three-legged OAuth with a third-party Identity Provider (corporate single sign-on, or SSO), and two-legged OAuth with a third-party Identity Provider (shared service user). Amazon Bedrock AgentCore Identity also supports an on-behalf-of (OBO) grant (TOKEN_EXCHANGE) that delivers per-user identity for unattended workloads without a consent prompt. We focus on the three configurations we tested end-to-end, flagging where OBO fits as we go. By the end, you will be able to identify which pattern suits your enterprise scenario.</p> <h2 id="solution-overview">Solution overview</h2> <p><a href="https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway.html" target="_blank" rel="noopener">Amazon Bedrock AgentCore Gateway</a>, a capability of Amazon Bedrock AgentCore, connects AI agents to external tool providers through MCP server targets. It targets the Snowflake-managed MCP server, which surfaces Cortex Search and Cortex Analyst as MCP tools that an MCP-aware client can discover and invoke. Rather than acting as a wrapper, the Gateway aggregates the capabilities of its configured targets into a single unified catalog, which it presents to the agent as one tools/list response.</p> <p>The core focus of this post is the <a href="https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway-outbound-auth.html" target="_blank" rel="noopener">outbound authentication</a> for Amazon Bedrock AgentCore Gateway: how it obtains and presents OAuth tokens to the Snowflake-managed MCP server. Amazon Bedrock AgentCore Identity acts as the credential broker: the Gateway obtains a workload token by calling GetWorkloadAccessTokenForJWT (because the Gateway uses JSON Web Token (JWT) inbound authentication), then calls GetResourceOauth2Token against the configured provider. AgentCore Identity owns the token vault, the token refresh, and the user-to-token binding, and it fetches, caches, and refreshes tokens automatically.</p> <p>Amazon Bedrock AgentCore Identity supports three OAuth configurations spanning two grant types (authorization_code and client_credentials):</p> <ol type="1"> <li><a href="https://docs.snowflake.com/en/user-guide/oauth-snowflake-overview" target="_blank" rel="noopener">Snowflake OAuth</a>: Snowflake acts as its own OAuth authorization server. Each user authenticates directly to Snowflake through the Authorization Code grant (3LO). No external identity provider is needed.</li> <li>Three-legged OAuth using a third-party Identity Provider: Users authenticate through corporate SSO with the Authorization Code grant. Snowflake trusts IdP-issued JSON Web Tokens (JWTs) through its <a href="https://docs.snowflake.com/en/user-guide/oauth-ext-overview" target="_blank" rel="noopener">External OAuth</a> security integration.</li> <li>Two-legged OAuth pattern using a third-party IdP: A shared service user authenticates through the client_credentials grant of the IdP. No user interaction or consent is required, which is ideal for machine-to-machine workloads.</li> </ol> <p>Amazon Bedrock AgentCore Identity also offers an API-key credential provider (which supports Snowflake Programmatic Access Tokens). We focus on OAuth here for per-user attribution and automatic token refresh. Each configuration uses a credential provider in Amazon Bedrock AgentCore Identity (CustomOauth2, OktaOauth2, or MicrosoftOauth2) and a corresponding security integration on the Snowflake side.</p> <p><strong>Note:</strong> We tested these patterns with the Snowflake-managed MCP server using Okta and Microsoft Entra ID. Patterns 2 and 3 (external IdP) follow standard OAuth flows, so they can extend to other OAuth-protected MCP servers, but validate the token claims, scopes, and audience settings for your SaaS provider. Only Pattern 1 is Snowflake-specific, because it relies on Snowflake’s built-in OAuth authorization server. The Snowflake-specific elements are the OAUTH_AUTHORIZATION_SERVER issuer-lock parameter, the session:role: / session:scope: grammar, BLOCKED_ROLES_LIST, LOGIN_NAME / EMAIL_ADDRESS mapping, and QUERY_HISTORY attribution. If your SaaS exposes its own internal OAuth server, you configure outbound OAuth the same way as Snowflake OAuth.</p> <table border="1px" width="100%" cellpadding="10px"> <tbody> <tr> <td><strong>Pattern</strong></td> <td><strong>OAuth grant</strong></td> <td><strong>AgentCore Identity credential provider vendor</strong></td> <td><strong>Snowflake security integration</strong></td> <td><strong>Snowflake query identity mapping</strong></td> </tr> <tr> <td>Snowflake OAuth – 3LO</td> <td>authorization_code</td> <td>Custom prov
AWS Machine Learning Blog · 18 thg 11, 2026
Nguyên văn nguồn Chi tiết nguồn