Skip to content

Snowflake sign-in for people with Entra ID

Verified 2026-11-11. Code: entra-snowflake-reference.

Most applications that query Snowflake for people do it through one shared service user. Snowflake then can't tell which person ran a query, so its roles and grants stop meaning much, and the shared credential has to be stored, rotated, and handed to every consumer.

With External OAuth and the Entra on-behalf-of flow, a person signs in to your application with Entra ID and the application calls Snowflake as that person: their user, their default role, their grants. The application holds no Snowflake credential.

flowchart LR
  U["Person"] -->|signs in| APP["Your app"]
  APP -->|on-behalf-of exchange| RA["Entra app: Snowflake OAuth Resource scope session:role-any"]
  APP -->|"token: aud = resource app, upn = person"| SI["Snowflake security integration (External OAuth)"]
  SI --> PU["Snowflake user LOGIN_NAME = UPN"]

For automation, which has no person to sign in, see the companion guide Rotating Snowflake secrets with a managed identity.

What you need

  • Entra: Application Administrator to create the two app registrations. Granting tenant-wide admin consent for the client may need a higher role, depending on your tenant's consent settings.
  • Snowflake: ACCOUNTADMIN once to create the security integration, then USERADMIN and SECURITYADMIN for users and grants.
  • Azure (demo app only): a Key Vault holding the demo app's client secret.

Nothing in this guide needs a warehouse. Every Snowflake statement is DDL, SHOW/DESC, or a context function such as current_user(), and those run without compute. You can follow it on a trial account without spending credits.

Versions verified

Component Version Used for
Python 3.14.10 deploy.py, the demo app
Azure CLI 2.91.0 Bicep deployments, test tokens
Bicep / Microsoft Graph Bicep extension 0.49.2 / v1.0 1.0.0 Entra app registrations as code
Snowflake CLI 3.33.0 Running the SQL as an administrator
snowflake-connector-python 5.2.0 OAuth sign-in
msal 1.39.0 The on-behalf-of exchange
azure-identity / azure-keyvault-secrets 1.27.0 / 4.12.0 The demo app reading its secret
starlette / uvicorn 1.10.0 / 0.54.0 The demo app
datastar-py / Datastar JS 1.0.3 / 1.0.5 The demo app's UI

Pages

  1. Setup. The Entra apps, the Snowflake integration, Entra v2 tokens, user mapping, the secondary-roles behaviour that lets administrator roles into application sessions, and the application code. It ends with a short Hardening section.
  2. Troubleshooting. Every error we hit and what caused it.

What the reference repository contains

Path Contents
snowflake-oauth/infra/main.bicep The Entra app registrations and consent grant
snowflake-oauth/sql/ The integration (01), users (02), token diagnosis (03), non-admin application users (10), teardown (99)
snowflake-oauth/deploy.py Drives the Bicep and SQL, reads a real token's iss/aud, verifies sign-in
snowflake-oauth/app/ A small demo app that runs the on-behalf-of exchange and shows both tokens' claims