Note

This connector is subject to the Snowflake Connector Terms.

Configuring Private Key Authentication for Snowflake

The Kafka and Kinesis high-performance connectors use PublishSnowpipeStreaming to write data to Snowflake. By default they authenticate using SNOWFLAKE_MANAGED (session token). This page describes how to switch to key-pair authentication using an RSA private key.

Note

SNOWFLAKE_MANAGED is the recommended authentication strategy for both SPCS and BYOC deployments. Use Private Key authentication only when managed authentication is not suitable for your environment.

The steps below apply identically to the Kafka and Kinesis high-performance connectors.

Prerequisites

Generate an RSA key pair and assign it to a Snowflake user

Follow the official Snowflake guide to generate a key pair and assign the public key to your user: Key-pair authentication and key-pair rotation.

Note

Both encrypted and unencrypted private keys are supported. If you generate an encrypted key (with a passphrase), set the Key Password property on the StandardPrivateKeyService controller service. The resulting rsa_key.p8 file must begin with the header -----BEGIN PRIVATE KEY----- (unencrypted) or -----BEGIN ENCRYPTED PRIVATE KEY----- (encrypted).

Step 1: Add a StandardPrivateKeyService controller service

  1. Open the connector’s process group in the Openflow / NiFi UI.
  2. Select Configure > Controller Services (gear icon).
  3. Select + to add a new controller service.
  4. Search for and select StandardPrivateKeyService.
  5. Select Add.

Step 2: Upload the private key file

  1. In the controller services list, select the Edit (pencil) icon on StandardPrivateKeyService.
  2. Locate the Key File property.
  3. Enable the Reference asset checkbox next to the field.
  4. Select Upload and select your rsa_key.p8 file. Openflow stores the file as an asset on the cluster so the key is never exposed in plain text in the configuration.
  5. Leave Key Password blank for an unencrypted key, or provide the passphrase for an encrypted key.
  6. Select Apply.

Step 3: Enable the controller service

Select the Enable (lightning bolt) icon on StandardPrivateKeyService and wait until its status shows Enabled.

Step 4: Configure PublishSnowpipeStreaming

  1. Double-click the PublishSnowpipeStreaming processor to open its properties.
  2. Set the following properties:
PropertyValue
Authentication StrategyKEY_PAIR
AccountYour Snowflake account identifier, for example myorg-myaccount
UserYour Snowflake username
RoleYour Snowflake role
Private Key ServiceSelect the StandardPrivateKeyService created in Step 1: Add a StandardPrivateKeyService controller service

Note

Account identifier format: Use the organization-and-account format <org_name>-<account_name>, not the full hostname. For example, if your Snowflake URL is https://myorg-myaccount.snowflakecomputing.com, the account identifier is myorg-myaccount.

  1. Select Apply.
  2. Start the process group.

Property reference

The StandardPrivateKeyService controller service accepts the following properties:

PropertyDescription
Key FilePath to the PKCS8 PEM private key file. Use Reference asset to upload the file directly to the cluster.
KeyInline PEM key content (alternative to Key File).
Key PasswordPassphrase for an encrypted private key. Leave blank for unencrypted keys.

Troubleshooting

SymptomLikely cause
PublishSnowpipeStreaming shows validation errors after applyingStandardPrivateKeyService is not yet enabled — enable it before starting the processor.
Authentication failure at runtimeVerify the public key is correctly assigned to the Snowflake user (DESC USER <username> should show RSA_PUBLIC_KEY set).
BEGIN ENCRYPTED PRIVATE KEY in key file but auth failsEncrypted key in use — ensure Key Password is set on StandardPrivateKeyService.
Wrong account identifier formatUse <org>-<account> without .snowflakecomputing.com.