Identity Federation in Snowflake using External OAuth
Introduction
Section titled “Introduction”Federated identity simplifies the login process by establishing a trust relationship between services.
In this case, Astrato acts as an identity provider, allowing users to connect to Snowflake using their access token.
With OAuth, Astrato can securely delegate access to Snowflake while verifying the user’s identity and sharing relevant attributes.
Instead of logging in directly to Snowflake, users only need to authenticate with Astrato. Astrato generates an access token that contains user attributes and sends it to Snowflake. The token is verified to ensure it originated from a trusted relationship with Astrato, making the authentication process more streamlined and secure.
-
-
Configuration Requierments
-
Technical Requierments
-
Pre Setup Requirements
Section titled “Pre Setup Requirements”-
Configuration Requirements:
Section titled “Configuration Requirements:”-
Snowflake ACCOUNTADMIN role
-
Astrato Administrator or Owner role
-
-
Technical requirements:
Section titled “Technical requirements:”-
Astrato uses email as a user’s unique identifier.
-
Each Astrato user that wants to use identity federation needs to exist on a Snowflake side with the same email address.
-
Astrato utilizes OAuth session:role-any, and it needs users to have a default Snowflake role defined.
-
Astrato requires users to have a default warehouse defined in Snowflake.
-
Identity Federation Setup
Section titled “Identity Federation Setup”-
To establish an identity federation between Snowflake and Astrato, it is necessary to configure both services accordingly. To do so, as an Astrato Administrator, navigate to Administration ➝ Enterprise Connection ➝ Identity federation, then click Add provider and select Snowflake.

-
On the Configuration tab, you can find the default settings that must be used to enable external security integration in Snowflake.

-
To create a Security integration in Snowflake, you will use the values found in Astrato’s Configuration tab.
external_oauth_issuer - value from Astrato Issuer above
external_oauth_audience_list - snowflake account url that would respect the tokens
external_oauth_jws_keys_url - value from JSON Web Key Sets above
external_oauth_scope_mapping_attribute - value from Scope mapping attribute above
external_oauth_token_user_mapping_claim - value from User mapping claim above
external_oauth_any_role_mode - Astrato uses session:role-any by default
external_oauth_snowflake_user_mapping_attribute - Astrato requires user’s email
(for example in this case we’ll use the Login Name as mapping attribute
-
Log in to Snowflake with a user who has an ACCOUNTADMIN role privilege or any other privileged user to create security integration.
Execute the SQL statement below.
Note: For more security-related options like allowed Snowflake roles and others, see Snowflake docs
CREATE OR REPLACE SECURITY INTEGRATION EXTERNAL_OAUTH_FOR_ASTRATO_ROLE_ANYTYPE = EXTERNAL_OAUTHENABLED = TRUEEXTERNAL_OAUTH_TYPE = CUSTOMEXTERNAL_OAUTH_ISSUER = 'https://app.astrato.io/tenant/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'EXTERNAL_OAUTH_AUDIENCE_LIST = ('https://xxxxxx.europe-west2.gcp.snowflakecomputing.com')EXTERNAL_OAUTH_JWS_KEYS_URL = 'https://app.astrato.io/auth/proxy/tenant/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/fed/jwks.json'EXTERNAL_OAUTH_SCOPE_MAPPING_ATTRIBUTE = 'scp'EXTERNAL_OAUTH_TOKEN_USER_MAPPING_CLAIM = 'sub'EXTERNAL_OAUTH_ANY_ROLE_MODE = 'ENABLE'-- Alternatively, map to 'login_name' instead of 'email_address'.EXTERNAL_OAUTH_SNOWFLAKE_USER_MAPPING_ATTRIBUTE = 'email_address'; -
Once it’s created in Snowflake, return to the Add provider panel in Astrato, where Snowflake is still selected, and open its Setup tab.

-
Display name - type in here any name that will let you recognize your configuration
-
Service account URL - type in here your Snowflake account url like:
https://xxxxxx.europe-west2.gcp.snowflakecomputing.com
Learn how to find your account URL.
Click Create
-
-
Once the Security integration is created, you can obtain a testing access token by clicking the “Generate test token” button.

-
Verify the token by copying its content and running this code in Snowflake.
select SYSTEM$VERIFY_EXTERNAL_OAUTH_TOKEN('your token')
If the token is valid you should see this result:

For debugging token errors, see documentation: Snowflake External OAuth Errors
-
After completing the setup process, you can use your identity federation in an Astrato data connection. Navigate into Data & AI ➝ Data Connections and select New connection.

-
Select Snowflake. The panel title changes to New Snowflake connection. The screenshot below shows an earlier version of the source list.

-
Under Authentication, choose Sign in with Snowflake. Then choose your identity federation from the OAuth connection list. Its entry shows the display name you gave it in step 5, such as Snowflake GK.
An identity federation needs no Sign in: Astrato issues the token itself, and the form says “Astrato issues this identity federation’s token. You can validate the connection directly.” If the form says instead that the identity federation has not confirmed the required authorization, ask your workspace administrator to check its access.
The screenshot below shows an earlier version of this form, which had an Oauth option and a Test connection button.

-
If your workspace offers a Deployment Region, choose one. Then select Validate Connection. When it succeeds, a Validation result section says “Connected to Snowflake in n ms.”
-
Under Session, Role and Warehouse read User default: each person queries with their own default role and warehouse in Snowflake. To set them for everyone instead, select Advanced beside the Session heading and choose them. Under Data to use, choose the Database.
-
Under Name, change the Connection name to something people will recognise, then select Save connection. The panel shows Connection created. If it offers a Schema, choose one or leave it as Choose later, then select Finish.