Snowflake
Trustle reads users, roles, role grants, object privileges, and sign-in, query, and access history from Snowflake. Trustle can create, disable, and drop users, and grant and revoke roles.
Prerequisites
Section titled “Prerequisites”- A Snowflake user with the ACCOUNTADMIN role. Only ACCOUNTADMIN can grant access to the
SNOWFLAKEdatabase. - Enterprise Edition or higher, for object-level usage. On Standard Edition, Snowflake has no access history. Trustle then uses query history only, so the permission analysis is less precise.
opensslon your computer, to create a key pair.- An identity provider connected in Trustle, for example Okta or Microsoft Entra ID. Trustle hides SaaS Applications until one is connected.
Configure Snowflake
Section titled “Configure Snowflake”Step 1: Open a SQL worksheet
Section titled “Step 1: Open a SQL worksheet”- Sign in to Snowsight as a user with the ACCOUNTADMIN role.
- Go to Projects → Workspaces.
- Create a new SQL file. You run the SQL from the next steps in this file.
Step 2: Grant permissions to a Trustle role
Section titled “Step 2: Grant permissions to a Trustle role”-
Run this SQL. It creates a role for Trustle and grants it the access in the table below.
CREATE ROLE IF NOT EXISTS TRUSTLE_ROLE COMMENT = 'Role for Trustle integration - DO NOT DELETE.';GRANT IMPORTED PRIVILEGES ON DATABASE SNOWFLAKE TO ROLE TRUSTLE_ROLE;GRANT ROLE SECURITYADMIN TO ROLE TRUSTLE_ROLE;Permission Required What Trustle does with it SECURITYADMINroleYes Reads users, roles, and grants. Creates and disables users. Grants and revokes roles. IMPORTED PRIVILEGESon theSNOWFLAKEdatabaseYes Reads sign-in history, query history, access history, and grants from ACCOUNT_USAGE.OWNERSHIPon a userOptional Drops that user. SECURITYADMINcan drop the users that it orUSERADMINowns. Without ownership, Trustle cannot drop the user.
Step 3: Create the warehouse
Section titled “Step 3: Create the warehouse”-
Run this SQL. Trustle runs its
ACCOUNT_USAGEqueries on this warehouse.CREATE WAREHOUSE IF NOT EXISTS TRUSTLE_ETL_WHWAREHOUSE_SIZE = 'XSMALL'AUTO_SUSPEND = 60AUTO_RESUME = TRUE;GRANT USAGE ON WAREHOUSE TRUSTLE_ETL_WH TO ROLE TRUSTLE_ROLE;
Step 4: Create a key pair
Section titled “Step 4: Create a key pair”-
On your computer, run these commands. They create an unencrypted private key in PKCS#8 format, and its public key.
Terminal window openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out trustle_rsa_key.p8 -nocryptopenssl rsa -in trustle_rsa_key.p8 -pubout -out trustle_rsa_key.pub
Step 5: Create the service user
Section titled “Step 5: Create the service user”-
Open
trustle_rsa_key.pub. Copy the key without the-----BEGIN PUBLIC KEY-----and-----END PUBLIC KEY-----lines. -
Run this SQL. Replace
<public-key>with the key you copied.CREATE USER TRUSTLE_SERVICE_ACCOUNTTYPE = SERVICEDEFAULT_ROLE = SECURITYADMINDEFAULT_WAREHOUSE = TRUSTLE_ETL_WHDEFAULT_SECONDARY_ROLES = ('ALL')COMMENT = 'Service Account for Trustle integration - DO NOT DELETE.'RSA_PUBLIC_KEY = '<public-key>';GRANT ROLE TRUSTLE_ROLE TO USER TRUSTLE_SERVICE_ACCOUNT;GRANT ROLE SECURITYADMIN TO USER TRUSTLE_SERVICE_ACCOUNT;Trustle signs in with the role
SECURITYADMIN, so the user needs it granted directly.DEFAULT_SECONDARY_ROLESkeeps theTRUSTLE_ROLEgrants active in the same session, so Trustle can use the warehouse and read account usage.
Step 6: Collect the values for Trustle
Section titled “Step 6: Collect the values for Trustle”| Trustle field | Where to find it in Snowflake | Example |
|---|---|---|
| Account Identifier | Snowsight → account menu → account details → Account Identifier | organization-account_name or xy12345.us-east-1 |
| Private Key | The whole trustle_rsa_key.p8 file from Step 4 |
-----BEGIN PRIVATE KEY----- … -----END PRIVATE KEY----- |
Connect in Trustle
Section titled “Connect in Trustle”- In Trustle, go to Connections.
- Under SaaS Applications, find Snowflake and click Connect.
- Enter a Connection Name, for example
Snowflake production. Description is optional. - Enter the values from Step 6. Paste the whole private key, with the
BEGINandENDlines. - Click Test Connection.
- After the test passes, click Save Connection.
Verify
Section titled “Verify”- On the Connections page, open the Snowflake connection.
- Wait for the first sync to finish.
- Check that the user count matches the result of
SHOW USERSin Snowflake. - Check that the roles from
SHOW ROLESshow in Trustle.
If something is missing, see Troubleshooting.
Security notes
Section titled “Security notes”Troubleshooting
Section titled “Troubleshooting”Test Connection fails
Section titled “Test Connection fails”Trustle does not show the reason yet. Check these values:
- Account Identifier: use
organization-account_nameorxy12345.us-east-1. Do not add.snowflakecomputing.comorhttps://. - Private Key: “Invalid private key format” means Trustle cannot read the key. Paste the whole
.p8file, from-----BEGIN PRIVATE KEY-----to-----END PRIVATE KEY-----. The key must not be encrypted. - User name: “Invalid credentials: authentication failed” means Snowflake refused the sign-in. Check that the user is named exactly
TRUSTLE_SERVICE_ACCOUNT. - Public key: the public key on
TRUSTLE_SERVICE_ACCOUNTmust come from the same key pair as the private key. If you are not sure, make a new key pair. Then runALTER USER TRUSTLE_SERVICE_ACCOUNT SET RSA_PUBLIC_KEY = '<public-key>'and paste the new private key.
Test Connection passes, but the sync fails
Section titled “Test Connection passes, but the sync fails”Test Connection does not use the warehouse or the grants. Check these items:
- The warehouse is named exactly
TRUSTLE_ETL_WH, and the role hasUSAGEon it. See Step 3. - The role has
IMPORTED PRIVILEGESon theSNOWFLAKEdatabase. See Step 2. TRUSTLE_SERVICE_ACCOUNTcan use the roleSECURITYADMIN. RunSHOW GRANTS TO USER TRUSTLE_SERVICE_ACCOUNT.
Object-level usage is missing
Section titled “Object-level usage is missing”Snowflake records access history only on Enterprise Edition or higher. On Standard Edition, Trustle uses query history only.
Trustle cannot drop a user
Section titled “Trustle cannot drop a user”Snowflake lets a role drop a user only if the role owns the user. Trustle uses SECURITYADMIN, which can drop the users that it or USERADMIN owns. Trustle cannot drop a user that another role owns, for example ACCOUNTADMIN. Transfer the ownership of that user to USERADMIN, then retry.
None of these fixes work
Section titled “None of these fixes work”Email support@trustle.com. Include the error message, the connection name, and the Account Identifier. Never send a secret, key, or token.