Skip to main content
ACCOUNTADMIN or equivalent privileges are required to assign a public key to a Snowflake user.

How key pair authentication works

Key pair authentication uses an RSA key pair that you generate yourself.

  • Private key (rsa_key.p8) — generated locally with OpenSSL. If you lose it, it cannot be recovered from Snowflake or the public key, so generate a new key pair and re-register the public key.
  • Public key (rsa_key.pub) — registered on your Snowflake user via ALTER USER.

Find your Account Identifier

Your Account Identifier uniquely identifies your Snowflake account and routes API requests to it.

1

Copy the Account Identifier

Sign in to your Snowflake account and click your user profile (showing your username and role) in the bottom-left corner of the sidebar.

  • In the menu that opens, click your account entry (e.g., Account: AB12345) to expand the account submenu.
  • Select View account details.
  • Copy the Account Identifier shown in the dialog.
  • Format: orgname-accountname (e.g., myorg-account123)
  • Alternative — run SELECT CURRENT_ORGANIZATION_NAME() || '-' || CURRENT_ACCOUNT_NAME(); in any worksheet

Find your username

Your Username is the Snowflake user the public key will be assigned to.

  • Run SELECT CURRENT_USER(); in any worksheet to see the user you are signed in as
  • Or navigate to Governance & security > Users & roles in Snowsight to pick a dedicated service user.
  • Casing does not matter.

Generate an RSA key pair

Snowflake key-pair authentication uses a 2048-bit RSA key pair that you generate yourself with OpenSSL. Run these commands in your terminal.

1

Generate the private key

Run the following command to generate an unencrypted private key in PKCS8 format.

  • This creates rsa_key.p8. Copy the RSA Private Key (PKCS8 PEM) across with its entire contents, including the BEGIN and END marker lines.
2

Extract the public key

Run the following command to extract the public key from the private key.

  • This creates rsa_key.pub, the public key you assign to your Snowflake user.

Assign the public key to your Snowflake user

The public key goes on the same Snowflake user as your Username.

1

Assign the key to your user

Open rsa_key.pub and copy the content between (but not including) the -----BEGIN PUBLIC KEY----- and -----END PUBLIC KEY----- lines.

In a Snowflake worksheet, switch to a role with permission to alter the user, then run the ALTER USER statement, replacing <username> with your Username and <public_key_body> with the value you copied.

  • The key body is the long base64 block from rsa_key.pub, pasted as a single quoted string (line breaks within it are allowed).
2

Verify the key assignment

Confirm the public key is registered on the user before connecting.

  • Check that the RSA_PUBLIC_KEY_FP property now shows a SHA256:... fingerprint value.
1

Connect

  • Click Connect.
  • If applicable, the provider will redirect you to a sign-in or authorization page. Complete the provider’s authorization flow.
  • Once authorization is successful, you will see a confirmation popup.
2

Use Actions

Connect an AI platform to the linked account’s actions. See AI Platforms.Other ways to call actions are listed in Protocols & SDKs.