Skip to main content

Snowflake

Snowflake is a cloud data warehouse platform that enables data storage, processing, and analytics with scalable compute and storage resources.

Authentication Types​

Snowflake supports 1 authentication method:

  • OAuth - Create your own Snowflake Security Integration with PKCE. Every user connects with their Snowflake account.
    • Pros: Secure, per-user tracking, production-ready
    • Cons: Requires Snowflake admin access

Configuration​

Before using the connector, you need to configure:

  • Snowflake Instance URL - Your Snowflake instance URL (e.g., https://yourcompany.snowflakecomputing.com)

Setting up OAuth​

  1. Log in to your Snowflake account with admin privileges

  2. Run the following SQL command to create a Security Integration:

CREATE SECURITY INTEGRATION willow_oauth
TYPE = OAUTH
ENABLED = TRUE
OAUTH_CLIENT = CUSTOM
OAUTH_CLIENT_TYPE = PUBLIC
OAUTH_REDIRECT_URI = '<copy from Willow platform>'
OAUTH_ISSUE_REFRESH_TOKENS = TRUE
OAUTH_REFRESH_TOKEN_VALIDITY = 7776000
OAUTH_ENFORCE_PKCE = TRUE
;
  1. Get the Client ID by running:
DESCRIBE SECURITY INTEGRATION WILLOW_OAUTH;
  1. Copy the OAUTH_CLIENT_ID value from the describe output

  2. In Willow, paste the Client ID

tip

You don't need a Client Secret because Snowflake uses PKCE (Proof Key for Code Exchange) for enhanced security. The Client ID combined with PKCE is sufficient for secure authentication.

  1. From the same DESCRIBE output, copy the OAUTH_AUTHORIZATION_ENDPOINT value and remove the trailing /oauth/authorize path to get your Instance URL — e.g. https://xxx.eu-central-2.aws.snowflakecomputing.com/oauth/authorize → https://xxx.eu-central-2.aws.snowflakecomputing.com. Enter this in Snowflake Instance URL in Configuration.

  2. Click Save Changes

Ask your Cortex Agents​

The connector can call Cortex Agents that already exist in your Snowflake account. Each call runs as the signed-in user's role.

To keep questions inside those agents, add a second Snowflake connection and turn off every tool except these three:

  • List Cortex Agents shows the agents the user's role can use.
  • Run Cortex Agent asks one agent a question and returns its answer.
  • Create Cortex Thread starts a conversation so a follow-up keeps the earlier context. Pass the returned thread id to Run Cortex Agent, along with the message id of the previous answer.

The user's default role needs USAGE on the agent and on the database and schema that hold it. Cortex does not use secondary roles.

GRANT USAGE ON DATABASE MY_DB TO ROLE MY_ROLE;
GRANT USAGE ON SCHEMA MY_DB.MY_SCHEMA TO ROLE MY_ROLE;
GRANT USAGE ON AGENT MY_DB.MY_SCHEMA.MY_AGENT TO ROLE MY_ROLE;

Calls made through Willow show up as tool calls. To also see prompts sent from Snowsight, and to use the agent from Slack with guards, connect it as a Snowflake Cortex background agent.

Troubleshooting​

Role Block Error​

If your users encounter the following error when trying to connect:

"The role requested has been explicitly blocked for use with this application by an administrator. Please try logging in with a different role, or contact your administrator."

Cause: The user's default role may not have the necessary permissions to use the OAuth integration.

Solution:

Have the user (or a Snowflake admin) run the following SQL command to set an appropriate default role:

ALTER USER <user-name>
SET DEFAULT_ROLE = <role>;

Replace <user-name> with the actual username and <role> with the a role different than ACCOUNTADMIN, ORGADMIN, or SECURITYADMIN.