liveBook · Manning

Private-key authentication

As explained in Snowflake Data Engineering

Key-pair authentication is an authentication method that uses a private cryptographic key for proving identity and a corresponding public key registered with the service.

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 = "<your Snowflake account>"
user = "<your username>"
authenticator = "SNOWFLAKE_JWT"
private_key_path = "<path to your private key>"
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

How Snowflake Data Engineering covers it

How deep it goes
Explains key generation, public-key assignment, CLI configuration, and connection testing, but defers detailed OpenSSL commands.
Examples
Uses OpenSSL keys, ALTER USER, config.toml, and snow connection test as operational artifacts.
What it assumes
Assumes access to OpenSSL, a Snowflake user, and privileges or administrator support for public-key assignment.
What you can do after
Operate/configure Snowflake CLI connections by registering a public key and supplying its private-key path.
How it connects
Connects Snowflake users, OpenSSL, Snowflake CLI, connection parameters, and continuous integration.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Snowflake Data Engineering. The section links point to the parts of the book it draws on.