snowflake-connector-net
snowflake-connector-net copied to clipboard
Error: Connection string is invalid: Invalid key value pair private_key_pwd="<Password which includes = sign>"
Issue description
I get the following error thrown immediately by the .Net driver when I try to connect using key pair authentication that has a private key password which contains a "=" sign
Error: Connection string is invalid: Invalid key value pair private_key_pwd="<password containing a = sign>" SqlS
tate: , VendorCode: 270008, QueryId:
Example code
This is the code I use to build the connection string
var builder = new SnowflakeDbConnectionStringBuilder();
builder.Add("account", connectionConfig.Account ?? throw new InvalidOperationException());
builder.Add("authenticator", "snowflake_jwt");
builder.Add("user", connectionConfig.Username ?? throw new InvalidOperationException());
builder.Add("private_key_file", connectionConfig.EncryptedPrivateKeyFilePath ?? throw new InvalidOperationException());
builder.Add("private_key_pwd", connectionConfig.EncryptedPrivateKeyPassword ?? throw new InvalidOperationException());
builder.Add("db", connectionConfig.Database ?? throw new InvalidOperationException());
builder.Add("schema", connectionConfig.Schema ?? throw new InvalidOperationException());
IDbConnection conn = new SnowflakeDbConnection();
conn.ConnectionString = builder.ConnectionString;
Configuration
*Driver version: 2.0.11
Dotnet framework and version: .net core 6 (console app)
*Client OS: Windows 10
I am also having a similar issue.
This is my connection string format
var ConnectionString =
$"scheme=STAGING;" +
$"account={0};" +
$"host={1}.snowflakecomputing.com;" +
$"role={2};" +
$"db={3};" +
$"warehouse={4};" +
$"authenticator=SNOWFLAKE_JWT;" +
$"user={5};" +
$"private_key_file={privateKeyPath}";
To clean up and re-prioritize more pressing bugs and feature requests we are closing all issues older than 6 months as of April 1, 2023. If there are any issues or feature requests that you would like us to address, please create them according to the new templates we have created. For urgent issues, opening a support case with this link Snowflake Community is the fastest way to get a response.