Skip to main content

Snowflake

Connection

Setup

Klef creates users in one Snowflake account, grants and revokes their account roles, and disables them. It signs in as a service user with a key pair, through Snowflake’s SQL API.
1
Make an RSA key pair of at least 2048 bits, as Snowflake’s key-pair authentication guide shows: openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocrypt, then openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub.
2
As an administrator, create the service user and give it the public key, without the PEM header and footer:
Klef needs MANAGE GRANTS to see every user and grant any role, and CREATE USER to create users. SECURITYADMIN holds both. A custom role works too, if it holds both privileges itself and is the role Klef runs as: Snowflake shows user details only for privileges of that role.
3
If the account has a network policy, allow Klef’s outbound addresses for the service user.
4
Copy the account identifier from Snowsight, under your name, then Connect a tool to Snowflake. Use the organization-account form, such as myorg-my_account, keeping any underscores.
5
In Klef, enter the account identifier, the service user’s name and the private key, and the passphrase if the key has one. Leave Role blank to use the service user’s default role, and click the Connect button.
Klef can change only users its role owns, which includes every user it creates. To manage a user another role created, grant Klef’s role MODIFY on that user, with GRANT MODIFY ON USER <name> TO ROLE SECURITYADMIN, or transfer its ownership.
Klef matches Snowflake’s users to your people by login name, so login names should be work email addresses, as single sign-on usually needs.

Settings

snowflake.user

Fields

Default Account Matching Rules

When Klef adopts an account that already exists in Snowflake, it works out whose it is by trying these in order. A connection can override them.

Examples

Snowflake users

A Snowflake user for every engineer, signing in through single sign-on in the role that carries their data access, disabled and cleared when they leave.