|
| 1 | +# Before you start |
| 2 | + |
| 3 | +## Creating an OAuth integration in Snowflake |
| 4 | + |
| 5 | +The Snowflake data source authenticates using OAuth. |
| 6 | + |
| 7 | +Before configuring the data source you will need to register SquaredUp with your Snowflake account bby creating a custom integration. |
| 8 | + |
| 9 | +Sample Snowflake commands for creating the integration are provided below. |
| 10 | + |
| 11 | +For more information on creating a Snowflake integration see: |
| 12 | +https://docs.snowflake.com/en/sql-reference/sql/create-security-integration-oauth-snowflake |
| 13 | + |
| 14 | + |
| 15 | +If your SquaredUp account is in the US region (default): |
| 16 | + |
| 17 | +``` |
| 18 | +CREATE SECURITY INTEGRATION oauth_squaredup |
| 19 | + TYPE = oauth |
| 20 | + OAUTH_CLIENT = custom |
| 21 | + OAUTH_CLIENT_TYPE = 'CONFIDENTIAL' |
| 22 | + OAUTH_REDIRECT_URI = 'https://app.squaredup.com/settings/pluginsoauth2' |
| 23 | + COMMENT = 'Used by SquaredUp to connect to this Snowflake account' |
| 24 | +``` |
| 25 | + |
| 26 | +If your SquaredUp account is in the EU region (default): |
| 27 | + |
| 28 | +``` |
| 29 | +CREATE SECURITY INTEGRATION oauth_squaredup |
| 30 | + TYPE = oauth |
| 31 | + OAUTH_CLIENT = custom |
| 32 | + OAUTH_CLIENT_TYPE = 'CONFIDENTIAL' |
| 33 | + OAUTH_REDIRECT_URI = 'https://eu.app.squaredup.com/settings/pluginsoauth2' |
| 34 | + COMMENT = 'Used by SquaredUp to connect to this Snowflake account' |
| 35 | +``` |
| 36 | + |
| 37 | +Once your integration is created, run: |
| 38 | + |
| 39 | +``` |
| 40 | +SELECT |
| 41 | + oauth:OAUTH_CLIENT_SECRET::STRING AS OAUTH_CLIENT_SECRET, |
| 42 | + oauth:OAUTH_CLIENT_ID::STRING AS OAUTH_CLIENT_ID |
| 43 | +FROM (SELECT PARSE_JSON(SYSTEM$SHOW_OAUTH_CLIENT_SECRETS('oauth_squaredup')) AS oauth) |
| 44 | +
|
| 45 | +``` |
| 46 | + |
| 47 | +Use the values of the `OAUTH_CLIENT_ID` and `OAUTH_CLIENT_SECRET` columns in your configuration below. |
| 48 | + |
| 49 | + |
| 50 | +## Creating a read-only user |
| 51 | + |
| 52 | +To connect to Snowflake you will need the credentials for a Snowflake user. |
| 53 | + |
| 54 | +By default, it is NOT possible to connect via OAuth using an ACCOUNTADMIN role. Snowflake automatically adds privileged roles to the blocked role list used for OAuth authorization, see https://docs.snowflake.com/en/sql-reference/parameters#oauth-add-privileged-roles-to-blocked-list |
| 55 | + |
| 56 | +We recommend a dedicated 'squaredup' user account that is assigned read only role. For more information on Snowflake users and roles, see https://docs.snowflake.com/en/user-guide/security-access-control-configure. |
| 57 | + |
| 58 | +Ensure the user has a default role set, or specify the role when configuring the data source (see below). If the user does not have a default role and no role is specified, the connection will use the PUBLIC role, which typically does not have any permissions to databases. |
| 59 | + |
| 60 | + |
| 61 | +# Configuration |
| 62 | + |
| 63 | +## Snowflake account identifier |
| 64 | + |
| 65 | +Enter your Snowflake account identifier. |
| 66 | + |
| 67 | +This can be found in the Snowflake portal under 'Your Username' > Account > Account Identifier. |
| 68 | + |
| 69 | +The account identifier It is in the format <org_name>-<account_name>, e.g. ABCDEFG-XYZ12345 |
| 70 | + |
| 71 | +For example: `https://<your-opensearch-host>:9200` |
| 72 | + |
| 73 | +Alternatively, run the following Snowflake query: |
| 74 | + |
| 75 | +``` |
| 76 | +SELECT CURRENT_ORGANIZATION_NAME() || '-' || CURRENT_ACCOUNT_NAME(); |
| 77 | +``` |
| 78 | + |
| 79 | +## Snowflake OAuth client ID |
| 80 | + |
| 81 | +The client ID for your Snowflake OAuth application. |
| 82 | + |
| 83 | +Enter the `OAUTH_CLIENT_ID` value from the integration you created above. |
| 84 | + |
| 85 | +## Snowflake OAuth client secret |
| 86 | + |
| 87 | +The client secret for your Snowflake OAuth application. |
| 88 | + |
| 89 | +Enter the `OAUTH_CLIENT_SECRET` value from the integration you created above. |
| 90 | + |
| 91 | +## Role (optional) |
| 92 | + |
| 93 | +Restrict OAuth connection to a specific role. If not specified, the user's default role is used. |
| 94 | + |
| 95 | +If you have created a custom role for your database, for example a read-only role, enter its name here. |
| 96 | + |
| 97 | +## Authorize |
| 98 | + |
| 99 | +Click the Sign-in button to authorize SquaredUp to access Snowflake. |
0 commit comments