CREATE ROLE levered_reader;GRANT USAGE ON WAREHOUSE LEVERED_WH TO ROLE levered_reader;GRANT USAGE ON DATABASE analytics_db TO ROLE levered_reader;GRANT USAGE ON SCHEMA analytics_db.public TO ROLE levered_reader;GRANT SELECT ON ALL TABLES IN SCHEMA analytics_db.public TO ROLE levered_reader;GRANT SELECT ON FUTURE TABLES IN SCHEMA analytics_db.public TO ROLE levered_reader;CREATE USER levered_svc PASSWORD = 'a-strong-password' DEFAULT_ROLE = levered_reader DEFAULT_WAREHOUSE = LEVERED_WH;GRANT ROLE levered_reader TO USER levered_svc;
Key pair authentication uses an RSA private key instead of a password. Snowflake recommends it for service accounts.
Generate an RSA key pair:
# Generate a 2048-bit private key in PKCS#8 PEM format (unencrypted)openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -nocrypt -out levered_rsa_key.pem# Extract the public keyopenssl rsa -in levered_rsa_key.pem -pubout -out levered_rsa_key.pub
Note: Snowflake recommends encrypted private keys (generated with -v2 des3 instead of -nocrypt). Levered currently supports unencrypted private keys only. If your security policy requires encrypted keys, generate an encrypted key and decrypt it before pasting it into the dashboard:
# Generate encrypted key (you'll be prompted for a passphrase)openssl genrsa 2048 | openssl pkcs8 -topk8 -v2 des3 -out rsa_key_encrypted.p8# Decrypt it for use with Leveredopenssl pkcs8 -in rsa_key_encrypted.p8 -nocrypt -out levered_rsa_key.pem
Create the user and assign the public key in Snowflake:
CREATE ROLE levered_reader;GRANT USAGE ON WAREHOUSE LEVERED_WH TO ROLE levered_reader;GRANT USAGE ON DATABASE analytics_db TO ROLE levered_reader;GRANT USAGE ON SCHEMA analytics_db.public TO ROLE levered_reader;GRANT SELECT ON ALL TABLES IN SCHEMA analytics_db.public TO ROLE levered_reader;GRANT SELECT ON FUTURE TABLES IN SCHEMA analytics_db.public TO ROLE levered_reader;CREATE USER levered_svc DEFAULT_ROLE = levered_reader DEFAULT_WAREHOUSE = LEVERED_WH;GRANT ROLE levered_reader TO USER levered_svc;-- Set the public key (paste the key content without the BEGIN/END lines)ALTER USER levered_svc SET RSA_PUBLIC_KEY = 'MIIBIjANBgkqh...your-public-key...';
Paste the contents of the private key into the dashboard. Paste the full PEM, including the -----BEGIN PRIVATE KEY----- and -----END PRIVATE KEY----- lines.
Check that the account identifier includes the region, for example xy12345.us-east-1. Check that the user has USAGE on the warehouse, the database and the schema.
Levered runs SQL queries during model training. If training fails with a permission error, check that the Snowflake user has SELECT access to the tables that the metric queries reference.