-
-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mssql support for azure ad auth (sqlcmd -G
)
#152
Comments
Generally speaking, to add support for a new command-line argument, the general procedure is to find the corresponding connection property, and turn it into a query parameter. For example, the property corresponding to the command-line argument So what's needed to support So the question is, what's the corresponding connection property for |
I am experiencing issues connecting to a SQL server in Azure with the "-G" flag with vim-dadbod as well. I've tried altering the sqlserver.vim adapter to include the "-G" and this seems to be working(I get the browser pop-up like in sqlcmd and I am able to successfully authenticate), but I only see a very limited set of schemas(dbo and sys) and cannot seem to access other objects that I successfully can access using sqlcmd directly. Any ideas where to start troubleshooting? |
@marhaasa are you specifying a target database in your connection string? I have also been playing around with the sqlserver.vim adapter to include the |
Thank you for reaching out @danarth and prompting me to further investigate my issue. I have now been fumbling around with this problem of mine a bit more and found a solution. I am a complete newbie on vim/neovim and vim plugins, so I am sure the problem was quite easy to adress to begin with. The problem I was facing with the adapter and specifying a database was due to how I altered the When using the Azure CLI to run |
No problem @marhaasa! Glad to hear you have it working now. I was able to follow the same steps with Looking at the A quick play around with @tpope so a potential solution to this is to avoid the Docs for the |
@danarth I think you're onto something. But If we look at the list of documented connection properties (which is where |
@tpope that's a really good point about compatibility with the old CLI/driver. However, even though I think it's going to be tricky to provide a solution for this adapter that is compatible with both the ODBC version and go version of the Thanks for the help by the way! |
Tricky at best, maybe impossible. I'm not going to hold out for the impossible.
Yeah, that's fine, and I wouldn't spill too many words on it. Perhaps just encourage the use of go-sqlcmd (which I take is intended to become the canonical implementation?) for full functionality. |
I am connecting to an azure sql db instance that uses azure ad auth.
can not connect with vim-dadbod
-G
option and omit both the username and passwordsqlcmd -S myserver.com -d mydatabase -G
logged in as on the cli with
az login
"isDefault": true
I see the following line in the
*dadbod-sqlserver*
section in the vim-dadboddocs:
This sounds like it means that if I omit the username and password in a
connection I will get the azure ad auth.
I had a look in
vim-dadbod/autoload/db/adapter/sqlserver.vim
and tried to adda
-G
in to likely-looking places but I am not familiar enough with vimscriptto get it working.
Are there any plans to add support for the new
-G
option?The microsoft docs for azure ad auth and the
-G
option are at:https://learn.microsoft.com/en-gb/sql/tools/sqlcmd/sqlcmd-authentication?view=sql-server-ver16&tabs=odbc
https://learn.microsoft.com/en-gb/sql/tools/sqlcmd/sqlcmd-authentication?view=sql-server-ver16&tabs=go
The text was updated successfully, but these errors were encountered: