newrelic-experimental / newrelic-snowflake-integration

New Relic integration with Snowflake to monitor query performance, logins, potential security incidents, optimise warehouse and cloud credit costs, capture any data stored in Snowflake for real-time alerting and reporting
Apache License 2.0
13 stars 17 forks source link

Key/Pair Authentication does not work with 'incorrect password' error #32

Closed PoeWunLee closed 2 years ago

PoeWunLee commented 2 years ago

Description

Snowflake integration authentication using username and password works fine, but not when switched to key-pair authentication. The error message describes that the username and password combination is not correct, which may have indicated that despite setting the useKeyPairAuth: true and specifying the p8 key file, the key-pair auth method is not used in the node.js driver internally.

Steps to Reproduce

  1. Install snowflakeintegration-win.exe in integrations.d>script folder
  2. Entered obfuscated credentials in config.yml in integrations.d>script folder with username and password as auth method (i.e. useKeyPairAuth=false) image
  3. Used dummy query (e.g. select * from snowflake.account_usage.tables limit 5) as per flex config described here: https://github.com/newrelic/newrelic-snowflake-integration/blob/main/flexConfigs/flex-snowflake-windows.yml (succeeded)
  4. Repeated step 3 but with useKeyPairAuth=true in config.yml (failed) image

Expected Behavior

Expected payload results returned. Expect to be the same payload result as when using username and password auth method. image

The following is what was returned instead when switched to key-pair auth image

Your Environment

Windows Virtual Machine on Azure

Additional context

matewilk commented 2 years ago

Hi @PoeWunLee

By the looks of it, when you want to use the useKeyPairAuth = true option, you also need to supply the configuration with the privateKeyPath.

So your credentials configuration should look like this:

credentials:
    useKeyPairAuth: true
    privateKeyPath: "path to the key file"
    account: "account"
    username: "user"
    role: "role"
    warehouse: "warehouse"