Snowflake key-pair authentication

Administration · Friday Demos · August 2, 2024 · 2:36

Some fresh code for using key-pair authentication with Snowflake - providing an extra layer of security to basic authentication (ie. username and password) when accessing your Snowflake.…

Transcript

This transcript is auto-generated. Names and product terms may be wrong.

  1. here's a demo of snowflake key pair authentication in Omni uh you'll see we have a new key pair section here in the connection setup screen you'll also see that there is a uh a line beneath the password dialogue showing you whether or not key pair authenication is enabled or disabled and so we'll go over here to the key pair section uh and generate a new key pair uh now notice uh when you generate a key pair this is the public key that comes back that's the one that's perfectly safe to uh handle it's not considered a secret uh this is the one that the user will configure in Snowflake uh when we generate the key pair the private key is going to be encrypted and

  2. immediately stored in an encrypted form uh it's not actually decryptable by anything except our querying pipeline so it's handled completely securely and it's not sitting around in anybody's laptop or anything like that so the uh public key is uh going to copy that and let's go ahead and enable this key pair so we'll go over to the settings page again you'll see the key pair authentication is now showing that it is enabled uh now notice you can have both the password and the key pair active at the same time um but when the key pair is active it will actually override and it will be the only authentication mechanism used um you'll see in this case uh the key pair authentication is failing because we

  3. haven't yet configured our snowflake user to use the key pair unfortunately this is the error that snowflake gives us it's not particularly descriptive but that is in fact what that means U so let's go into snowflake we copied the key pair already we're going to paste it in here this is the uh command to set the key pair for this user so we're going to do that uh that is done go back test again and great it's working so uh the other thing I want to show you is that we can actually use this system to roll over Keys seamlessly so uh we can generate a second key pair here um and if we wanted to roll over the key what we can do is

  4. uh we can copy this second key pair value snowflake has a command to assign a secondary key pair to the user so we can assign that to the user uh and then uh we can go back and you we can activate the secondary key pair uh and it will start working seamlessly with no interruption to the connection then we can go back later and disable all of the old key pairs