Updating Snowflake Integration with Key Pair Authentication (Monte Carlo)
Follow these steps to update your Snowflake connection to use key-pair authentication via the Monte Carlo API.
Step 1: Prepare the Private Key
Before starting, generate and test your public and private key pair as outlined in Snowflake’s documentation.
Step 2: Encode the Private Key
To properly encode the key, run the following command:
```bash
echo -n '-----BEGIN ENCRYPTED PRIVATE KEY-----
XXXXXXXX
-----END ENCRYPTED PRIVATE KEY-----' | base64 > nospaces.txt
```
For Linux users, use the following command to avoid generating a new line:
```bash
cat rsa_key.p8 | base64 | tr -d '\n'
```
Alternatively, you can copy the file to a Mac or Windows machine for encoding.
Once encoded, use the command `pbcopy < nospaces.txt` to copy the key to your clipboard. Paste it later during the API call in the Monte Carlo API Explorer.
---
Step 3: Upload the Encoded Private Key
Go to **Settings > API > API Explorer** in your Monte Carlo account. Use the following mutation to upload the private key:
```graphql
mutation uploadUpdatedSnowflakeCredentialsV2(
$changes: SnowflakeUpdateConnectionDetails!,
$connectionId: UUID!
) {
updateSnowflakeCredentialsV2(
changes: $changes,
connectionId: $connectionId
) {
result {
key
success
}
}
}
```
Variables:
```json
{
"connectionId": "<your_connection_id>",
"changes": {
"privateKey": "<your_base64_encoded_private_key>"
}
}
```
---
Step 4: Apply the Updated Credentials
After uploading the credentials, apply them to the Snowflake connection with the following mutation:
```graphql
mutation updateCredentialsV2(
$tempCredentialsKey: String!,
$connectionId: UUID!
) {
updateCredentialsV2(
tempCredentialsKey: $tempCredentialsKey,
connectionId: $connectionId
) {
success
}
}
```
Variables:
```json
{
"connectionId": "<your_connection_id>",
"tempCredentialsKey": "<temp_key_from_previous_response>"
}
```
---
Step 5: Verification
Once you receive a `200 OK` response, go to the **Integrations tab** in your Monte Carlo account to verify that the connection is working properly, the connection type in the edit screen should show it is using key/pair authentication.
Comments
0 comments
Please sign in to leave a comment.