Private-key authentication proves a Snowflake user’s identity with a private cryptographic key paired with a registered public key. It suits automated data pipelines because it avoids manual approval steps required by methods such as MFA. section 15.5
Configure the connection in four steps:
- Generate a public and private key with OpenSSL. The unencrypted option without a passphrase simplifies the exercise. section 15.5.1
- Assign the generated public key to the Snowflake user with ALTER USER; an administrator may need to run the command. section 15.5.1
- Replace password authentication in config.toml with authenticator = SNOWFLAKE_JWT and a private_key_path entry. section 15.5.1
- Run snow connection test, then use Snowflake CLI commands against the configured connection. section 15.5.1
use role SECURITYADMIN; alter user <your username> set rsa_public_key = 'MII...';
Assigns the public key to the Snowflake user through SECURITYADMIN and ALTER USER. section 15.5.1
default_connection_name="my_connection"[connections.my_connection]account="<yourSnowflakeaccount>"user="<yourusername>"authenticator="SNOWFLAKE_JWT"private_key_path="<pathtoyourprivatekey>"database="BAKERY_DB"warehouse="BAKERY_WH"role="DATA_ENGINEER"
Shows a Snowflake CLI connection using SNOWFLAKE_JWT, a private-key path, and operational context such as role, database, and warehouse. section 15.5.1
snow connection test
Tests whether the configured key-pair connection works before executing pipeline commands. section 15.5.1
