deniz.in

Markets

Weather

Loading weather

· via dev.to (home feed)

AWS-tested OAuth patterns for AI agents on Snowflake Cortex hinge on per-user attribution

AWS tested three OAuth patterns for authenticating AI agents to Snowflake Cortex; the choice decides whether audit logs record real users or one shared service account.

AWS-tested OAuth patterns for AI agents on Snowflake Cortex hinge on per-user attribution

AWS has tested three OAuth patterns end to end for AI agents that query Snowflake Cortex, according to a write-up published on dev.to and originally posted on Agentic Affairs. The exercise was less about plumbing than about governance: each pattern answers differently the question of whether an agent's query is credited to the person behind it or to a machine identity shared across the organisation.

The default creates an attribution gap

The write-up argues that most teams reach for a single broad service account because it is the fastest route to a working agent. That holds up until compliance staff ask which individual ran a specific query, and every row in Snowflake's QUERY_HISTORY view shows the same machine name. At that point per-user attribution is gone, and row-level security plus data masking that depend on the requester's identity stop functioning as designed.

Pattern 1: Snowflake as its own identity provider

The first pattern uses Snowflake's built-in OAuth server. Users authenticate directly, and every query executes under the real user and that user's role, so auditing behaves as intended. The costs: users need Snowflake credentials, and the implementing team owns the whole flow, including consent screens, role scopes that must be written in uppercase, and a ten-minute window for completing the token exchange. The write-up's verdict is that this is fine for a proof of concept but not a corporate identity strategy.

Pattern 2: Corporate single sign-on

The second pattern keeps per-user attribution while handing authentication to a corporate identity provider such as Okta or Microsoft Entra ID. Multi-factor authentication, conditional access and session policies arrive with the IdP rather than being rebuilt. Notably, Snowflake checks the JWT locally against the keys the IdP publishes and does not contact the IdP at runtime. One caveat the testing surfaced: disabling a user in the IdP does not revoke tokens the agent has already cached. They keep working until they expire unless re-authentication is forced explicitly.

Pattern 3: The shared service user

The third pattern authenticates the agent as a machine-to-machine client, skipping consent screens and browser redirects entirely. The price is that no individual identity travels with the request: every query runs as one service user holding one role, and row-level security collapses to that single identity. The piece reports AWS's position as direct on this point: it suits genuinely unattended batch jobs and becomes the wrong choice the moment someone needs to know who requested a given piece of data.

A fourth option: on-behalf-of exchange

The write-up also flags an approach it says AWS covers only briefly: on-behalf-of, or OBO, token exchange. OBO delivers per-user identity for unattended workloads without a consent step or a browser round-trip, while QUERY_HISTORY still records the actual user. The author's recommendation is that teams whose auditors require real usernames, and whose workloads involve no human in the loop, evaluate OBO before settling for a shared service account.

The longer article on Agentic Affairs documents the concrete wiring for each pattern, including security integrations, role scopes, token lifetimes, and Entra ID claim-mapping pitfalls such as mapping LOGIN_NAME to a GUID.

Why it matters

As agents move from prototypes into production workloads that touch governed data, identity is the control that determines whether existing security investments still function. The OAuth pattern chosen at build time decides whether audit trails name people or one service account, and that history cannot be reconstructed after the fact. For interactive agents, the write-up positions Pattern 2 as the pragmatic default for most enterprises because it layers per-user attribution onto identity infrastructure they already run. For unattended workloads, OBO offers a way to keep attribution without adding a human back into the loop. The lesson also generalises beyond Snowflake: any platform that exposes governed data to agents will face the same question, and answering it with a shared credential quietly switches off the row-level security and masking policies an organisation spent years putting in place.

  • #oauth
  • #snowflake
  • #ai-agents
  • #identity
  • #cloud

Related posts