Using Snowflake Key Pair Authentication with Tableau Desktop

I have gotten irrationally annoyed at the (admittedly minor) process of connecting directly to Snowflake lately. When I am using my saved Tableau Online Data Sources it is a single click to connect. When I am connecting directly to Snowflake, I need to go login to my password vault, find my account, copy and paste the password, and connect. With today’s hectic lifestyle, who has the time?

Luckily, there is an easier way! I couldn’t quite get the approach outlined at Tableau – Snowflake key-pair authentication to work, but it had almost everything. Here is what I’ve started using.

Follow the instructions at Key Pair Authentication & Key Pair Rotation to create your public and private keys, then have a Security Admin add them to your login in Snowflake. I recommend renaming them from the default file name (i.e., your login name instead of ‘rsa_key’) and make sure you store your passphrase in your password vault.

Next, you’ll create the string with your Custom Driver Parameters that references the private key file and passphrase you just generated. That will look like

AUTHENTICATOR=SNOWFLAKE_JWT;PRIV_KEY_FILE=PATH-TO-KEY-FILE;PRIV_KEY_FILE_PWD=PASSPHRASE

I saved this in my password vault as well to make it easy to reuse.

Now we’re going to connect to Snowflake setting the Server/Role/Username, leaving the Password Blank, and using the Custom Driver Parameters we created above.

After signing in, we could go ahead and finish setting up our Data Source, but we won’t. We’ll go ahead and click off to a sheet instead. That means we can now add this as a Saved Data Source.

I then save these named based on the Username/Role.

At this point, you can close this workbook without saving and we can test it out.

Now I can just click on the new Saved Data Source to connect. It will prompt me for credentials, but I can just click OK and it will use the Key Pair to connect. Clicking ‘Edit Connection’ at this point takes you directly to the next step of setting up the Data Source.

Now I can finish setting up the Data Source!

Now, just one thing to be aware of… Since this relies on a local key file, you can’t publish it directly to Tableau Online.

However, if you edit the connection and add your Password / remove the Custom Driver Parameters you can now publish the workbook as normal.

That’s it! You now have a Saved Data Source that saves you a few steps when connecting to Snowflake!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Powered by WordPress.com.

Up ↑

Discover more from Datagami

Subscribe now to keep reading and get access to the full archive.

Continue reading