This guide walks through configuring Entra ID for OAuth 2.0 On-Behalf-Of (OBO) flow with Snowflake external OAuth integration, enabling seamless federated identity between Astrato, Entra ID, and Snowflake.
Overview
The federated identity system allows users to authenticate once in Astrato via Entra ID and seamlessly access Snowflake without re-authentication. The system uses the OAuth 2.0 On-Behalf-Of flow to exchange Entra ID tokens for Snowflake-targeted tokens.
How it works
The authentication flow happens in three stages:
Initial Authentication β The user logs into Astrato, which initiates an OAuth2 Authorization Request to the Entra ID Web App. The user authenticates (including MFA), and Astrato receives an ID Token, Access Token, and Refresh Token.
OAuth 2.0 On-Behalf-Of Flow β When the user requests Snowflake data, Astrato uses the user's Access Token to request a Snowflake-scoped token from Entra ID via the OBO grant. Entra ID validates the app permissions and returns a Snowflake Access Token containing the user's email claim.
Snowflake Authentication β Astrato connects to Snowflake using the federated token. Snowflake validates the token signature via the JWKS endpoint, maps the user by their email claim, assigns roles, and returns query results.
Prerequisites
Astrato Account with administrative access
Entra ID Tenant with administrative access
Snowflake Account with ACCOUNTADMIN privileges
Step 1: Configure Entra ID Web Application for Astrato
1.1 Create / Configure Web App Registration
Navigate to Entra ID Portal β App registrations
Select your existing web app or create a new one
Note down the Application (client) ID β this will be your
{web-app-id}(used in section 2.1.5)Note down the Directory (tenant) ID β this will be your
{entra-tenant-id}(used in section 2.1.5)In the top menu click Endpoints, then locate the OpenID Connect metadata document endpoint and open it. In the JSON response, find and copy the value of the
issuerfield β this will be your{issuer-url}(used in section 2.1.5)
1.2 Configure Authentication Settings
Go to Authentication in the left menu
Click + Add Redirect URI
Select Web
Add the following Redirect URIs (you can find these from section 2.1.4):
1.3 Configure Certificates & Secrets
Go to Certificates & secrets
Click + New client secret
Add a Description: "Web App Client Secret"
Set Expires: Choose an appropriate duration (6 months, 12 months, etc.)
Click Add
Copy and securely store the secret value β you'll need this in section 2.1.5
1.4 Configure API Permissions
Navigate to API permissions
Ensure the following Microsoft Graph delegated permissions are present:
User.Reademailopenidprofile
Note: Permission to access the Snowflake App API will be added in Step 4.1.
Step 2: Configure Astrato SSO Login
2.1 Create Astrato SSO Login
In Astrato, go to the Administration section β Enterprise Connection
Click New Connection
Select Microsoft Azure AD
Note down the Callback URLs β you'll need these in step 1.2 above
Go to the Setup tab and fill in the form:
Connection Name
Issuer URL:
{issuer-url}Client ID:
{web-app-id}Client Secret
Identity provider domains
Click Save
2.2 Verify the Connection
Click Verify to confirm the integration is working correctly
Step 3: Configure Entra ID Snowflake Resource
3.1 Create Snowflake App Registration
Navigate to Entra ID Portal β App registrations
Click + New registration
Name: "Snowflake External OAuth Integration" (or similar)
Supported account types: Select Accounts in this organizational directory only (Single tenant)
Click Register
Note down the Application (client) ID β this will be your
{snowflake-app-id}
3.2 Expose Snowflake API
Navigate to Expose an API
Click Add next to "Application ID URI"
Use:
api://{snowflake-app-id}β this will be your{entra-snowflake-audience}Click Save
Click + Add a scope and fill in the following:
Scope name:
session:role-anyAdmin consent display name: "Access Snowflake on behalf of user"
Admin consent description: "Allow applications to access Snowflake on behalf of the signed-in user with flexible role assignment"
User consent display name: "Access Snowflake"
User consent description: "Allow this app to access Snowflake on your behalf"
State: Enabled
Click Add scope
3.3 Configure Token Configuration
Navigate to Token configuration
Click + Add optional claim
Token type: Access tokens
Select the email claim
Click Add
If prompted about Microsoft Graph permissions, click "Turn on the Microsoft Graph email permission."
Step 4: Link Applications Together
4.1 Grant Astrato Web App Permission to Access Snowflake App API
Navigate to your Web App registration (
{web-app-id})Go to API permissions
Click + Add a permission
Click the APIs my organization uses tab
Search for your Snowflake app name or
{snowflake-app-id}Select the Snowflake application
Select Delegated permissions
Check session:role-any
Click Add permissions
4.2 Grant Admin Consent
In the API permissions page of your Web App, click Grant admin consent for [Your Organization]
Click Yes in the confirmation dialog
Verify that all permissions show "Granted for [Your Organization]" with green checkmarks
Step 5: Configure Astrato Federation for Snowflake
5.1 Create Entra ID β Snowflake Identity Federation
In Astrato, go to Enterprise Connection β Identity Provider tab
Click New Provider
Select Entra ID Token Exchange
Fill in the Setup form:
Display Name
Service account URL: Your Snowflake account URL
SSO Connection: Select the Astrato SSO connection configured in section 2.1
Token Audience:
{entra-snowflake-audience}(typically in the formapi://{snowflake-app-id})
Click Create
Once saved, users who sign in to Astrato with Entra ID will automatically gain access to the configured Snowflake account URL, provided they have been assigned the necessary permissions in both Entra ID and Snowflake.
Step 6: Configure Snowflake External OAuth Integration
6.1 Create External OAuth Integration
Execute the following SQL in Snowflake, replacing the placeholders with your actual values:
CREATE OR REPLACE SECURITY INTEGRATION AZURE_OAUTH_INTEGRATION
TYPE = EXTERNAL_OAUTH
ENABLED = TRUE
EXTERNAL_OAUTH_TYPE = AZURE
EXTERNAL_OAUTH_ISSUER = 'https://sts.windows.net/{entra-tenant-id}/'
EXTERNAL_OAUTH_AUDIENCE_LIST = ('{entra-snowflake-audience}')
EXTERNAL_OAUTH_JWS_KEYS_URL = 'https://login.microsoftonline.com/{entra-tenant-id}/discovery/v2.0/keys'
EXTERNAL_OAUTH_TOKEN_USER_MAPPING_CLAIM = 'email'
EXTERNAL_OAUTH_ANY_ROLE_MODE = 'ENABLE'
EXTERNAL_OAUTH_SNOWFLAKE_USER_MAPPING_ATTRIBUTE = 'login_name';
6.2 Test the Integration
In the Astrato Identity Federation created in section 5.1, click Generate to create a token
In Snowflake, run the following SQL with the generated token:
select SYSTEM$VERIFY_EXTERNAL_OAUTH_TOKEN('<token>')

