You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/connections/storage/catalog/snowflake/index.md
+65-6Lines changed: 65 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -86,7 +86,46 @@ GRANT CREATE SCHEMA ON DATABASE "SEGMENT_EVENTS" TO ROLE "SEGMENT";
86
86
87
87
### Step 4: Create a user for Segment
88
88
89
-
Create the user that Segment uses to connect to your warehouse. Be sure to use a strong, unique password.
89
+
Create the user that Segment uses to connect to your warehouse. You can create a user that authenticates with a key pair, or you can create a user that authenticates using a password. Segment recommends creating a user that will authenticate with an encrypted key pair.
90
+
91
+
#### Create a user that authenticates with a key pair
92
+
If you are creating a user that will use a key pair to authenticate, you first must create a public key, and then can create a new user.
93
+
94
+
##### Generate a key
95
+
96
+
To start, open a terminal window and generate a private key by running the following command, replacing `key_name` with the name you'd like to give the key. The command generates a private key in PEM format, and will prompt you to enter a passphrase. Write down or remember this passphrase, as you will need it when creating your Segment user and configuring your destination in the Segment app.
97
+
98
+
> success ""
99
+
> If you want to generate an unencrypted key, append `-nocrypt` to the end of the command.
After you've created the private key, save the file to a local directory. You'll need to upload the .p8 file to the Segment app when you create your Snowflake destination.
106
+
107
+
Next, generate your public key by running the following command, replacing `key_name.p8` with the name of the private key that you previously created and `public_key_name` with the name of your new public key.
After you've created the public key, save the file to a local directory.
114
+
115
+
##### Generate a new user and assign the key to them
116
+
117
+
Now, create a new user by executing the following SQL command, replacing the public key value with the key you previously generated. If you generated an unencrypted key, omit the `RSA_PUBLIC_KEY_FP` value, as it is only required for encrypted keys.
118
+
119
+
```sql
120
+
CREATEUSERSEGMENT_USER
121
+
DEFAULT_ROLE ="SEGMENT"
122
+
RSA_PUBLIC_KEY ='MIIBIjANBgkqh...'
123
+
RSA_PUBLIC_KEY_FP ='enter the passphrase you created';
124
+
GRANT ROLE "SEGMENT" TO USER "SEGMENT_USER";
125
+
```
126
+
127
+
#### Create a user that authenticates with a username and password
128
+
If you are creating a user that will use a username and password to authenticate, execute the following SQL command. Be sure to set a strong, unique password.
90
129
91
130
```sql
92
131
CREATEUSER "SEGMENT_USER"
@@ -98,8 +137,12 @@ GRANT ROLE "SEGMENT" TO USER "SEGMENT_USER";
98
137
99
138
### Step 5: Test the user and credentials
100
139
101
-
Before you continue, test and validate the new user and credentials. When you can run the following commands successfully, you can connect Snowflake to Segment.
140
+
Before you continue, test and validate the new user and credentials. After you verify the new credentials, you can connect Snowflake to Segment.
102
141
142
+
#### Test a key pair
143
+
To verify that you've configured the key pair correctly, follow Snowflake's instructions in the [Verify the user's public key fingerprint](https://docs.snowflake.com/en/user-guide/key-pair-auth#verify-the-user-s-public-key-fingerprint){:target="_blank"} documentation.
144
+
145
+
#### Test a username and password
103
146
Segment uses [SnowSQL](https://docs.snowflake.com/en/user-guide/snowsql){:target="_blank"} to run these verification steps.
104
147
To install SnowSQL and verify your accounts:
105
148
@@ -167,12 +210,20 @@ After configuring your Snowflake resources, connect them to Segment.
167
210
168
211
1. In the Segment App, select Add Destination.
169
212
2. Search for and select "Snowflake".
170
-
3. Add your credentials as follows:
171
-
-**User**: The user name that you created in [Step 4: Create a user for Segment](#step-4-create-user-for-segment)
172
-
-**Password**: The password that you set in [Step 4: Create a user for Segment](#step-4-create-user-for-segment)
213
+
3. Enter a name for your destination.
214
+
4. Enter your Snowflake credentials as follows:
173
215
-**Account**: The account id of your cluster, not the url (for example, url: `my-business.snowflakecomputing.com`, account-id: `my-business`. **Note:** If you are using Snowflake on AWS, the account id includes the region. For example, your url might be: `my-business.us-east-1.snowflakecomputing.com/` and your account-id would be: `my-business.us-east-1`)
174
-
-**Database**: The database name that you created in [Step 2: Create database](#step-2-create-database)
175
216
-**Warehouse**: The name of the warehouse that you created in [Step 1: Create a virtual warehouse](#step-1-create-a-virtual-warehouse)
217
+
-**Database**: The database name that you created in [Step 2: Create database](#step-2-create-database)
218
+
-**Username**: The username that you created in [Step 4: Create a user for Segment](#step-4-create-user-for-segment)
219
+
-**Authentication method**: Select the authentication method that you used when creating a user in [Step 4: Create a user for Segment](#step-4-create-user-for-segment). You can select either Key pair or Password.
220
+
221
+
If you selected Key pair as your authentication method:
222
+
-**Private key**: Upload your private key (stored in .p8 format) that you created in [Step 4: Create a user for Segment](#step-4-create-user-for-segment)
223
+
-**Passphrase**_(Optional)_ : If you created an encrypted key, enter the passphrase you created in [Step 4: Create a user for Segment](#step-4-create-user-for-segment)
224
+
225
+
If you selected Password as your authentication method:
226
+
-**Password**: The password that you set in [Step 4: Create a user for Segment](#step-4-create-user-for-segment)
176
227
177
228
## Security
178
229
@@ -188,6 +239,10 @@ At this time, the Segment Snowflake destination is not compatible with Snowflake
188
239
189
240
## Best Practices
190
241
242
+
### Key pair authentication
243
+
244
+
Segment recommends that you authenticate with your Snowflake warehouse using key-pair authentication. Key-pair authentication uses PKCS#8 private keys, which are typically exchanged in the PEM base64-encoded format.
245
+
191
246
### Auto Suspend and Auto Resume
192
247
193
248
Set `AUTO_SUSPEND` to ~10 minutes in the UI (or 600 if using SQL) to minimize the credit consumption of Segment's syncing process.
@@ -249,3 +304,7 @@ Queuing - you can use a different Warehouse for Segment, or use the recommendati
### I'm running into a "JWT token is invalid" error. What do I do?
309
+
310
+
For more information about troubleshooting a `JWT token is invalid` error, see Snowflake's [Key Pair Authentication: Troubleshooting](https://docs.snowflake.com/user-guide/key-pair-auth-troubleshooting){:target="_blank”} documentation.
0 commit comments