Snowflake - Retrieve a private key

Context This page is linked to the Snowflake connector creation process. It will allow you to use the Public Key authentication method.

1

Create a private key

If you haven’t created a key pair yet, you can generate one with the openssl command-line tool. Use the following command to produce an unencrypted private key file:

openssl genpkey -algorithm RSA -out rsa_key.pem -pkeyopt rsa_keygen_bits:2048

A new file rsa_key.pem should be created in your current folder

2

Generate a matching public key

Once you have your private key, you need to generate a matching public key. You can do so with the following command:

openssl rsa -in rsa_key.pem -pubout -out rsa_key.pub

A new file rsa_key.pub should be created in your current folder.

3

Add the public key to a Snowflake User

While on Snowflake editior, You can use this SQL command. Replace <user_name> with your user name and <public_key_value> with your public key.

use role securityadmin;

alter user YOUR_USER_NAME
set rsa_public_key='YOUR PUBLIC KEY'; // Paste here your public key

If you want to check to be sure this user is linked to your public key, you can check with this command

show users like 'YOUR_USER_NAME';

The should be set to true

4

Success !

You can now resume your connector creation

Last updated

Was this helpful?