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
It doesn't seem possible to create a database connection when using AzureSQL syntax for connection_url with user/pass templating.
Using the other syntax works fine however.
Start a local MSSQL container docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=My5trongP4ssword#" -p 1433:1433 -d mcr.microsoft.com/mssql/server:2019-latest
Enable the DB engine vault secrets enable database
Error writing data to database/config/my-database: Error making API request.
URL: PUT http://127.0.0.1:8200/v1/database/config/my-database
Code: 400. Errors:
* error creating database object: error verifying connection: Login error: mssql: Login failed for user 'sa'.
First encountered this problem trying to setup a AzureSQL database, which recommends this syntax for the connection string. Tried locally and I was able to replicate. The documentation shows it working without templating using this syntax, but doesn't say that we can't use it
The text was updated successfully, but these errors were encountered:
Hi @Matroxt, I looked into this and it appears to be a bug related to escaping special characters. In particular it seems ADO style connection strings should not be escaped (vault is escaping special characters so they can be used in URLs, so your password is being rendered to my5trongP4ssword%23.
I was able to make to work by changing your password slightly:
Hi @Matroxt
I wanted to let you know that #13414 was merged about 2 weeks ago to address this and it will go out in Vault 1.10. Please let us know if the issue persists for you. Note that the docs aren't updated yet to reflect this new parameter.
Describe the bug
It doesn't seem possible to create a database connection when using AzureSQL syntax for
connection_url
with user/pass templating.Using the other syntax works fine however.
This doesn't work ❌ :
You'll get this error:
error creating database object: error verifying connection: Login error: mssql: Login failed for user 'sa'.
This works ✅ :
To Reproduce
Steps to reproduce the behavior:
vault server -dev
vault login
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=My5trongP4ssword#" -p 1433:1433 -d mcr.microsoft.com/mssql/server:2019-latest
vault secrets enable database
Expected behavior
Success in both cases.
Both those syntax should behave the same when using templating:
server=localhost;port=1433;user id={{username}};password={{password}};database=master;
sqlserver://{{username}}:{{password}}@localhost:1433/instance?database=master
Environment:
Additional context
First encountered this problem trying to setup a AzureSQL database, which recommends this syntax for the connection string. Tried locally and I was able to replicate.
The documentation shows it working without templating using this syntax, but doesn't say that we can't use it
The text was updated successfully, but these errors were encountered: