microsoft / go-sqlcmd

The new sqlcmd, CLI for SQL Server and Azure SQL (winget install sqlcmd / sqlcmd create mssql / sqlcmd open ads)
https://learn.microsoft.com/sql/tools/sqlcmd/go-sqlcmd-utility
MIT License
343 stars 60 forks source link

ADS Login Fails if a container is deleted and a new one is created #432

Open dlevy-msft opened 1 year ago

dlevy-msft commented 1 year ago

The credentials stored for a sql container are being persisted in ADS and not overwritten when a new container is created. This causes a login failure in ADS and forces a reset of the password, putting the context in SQLCMD out of synch with the creds in the SQL container.

There are 2 things that probably need to happen here:

  1. ADS creds for a container need to be deleted when a container is deleted.
  2. SQLCMD needs a mechanism to change a user password to avoid out of synch contexts - this should probably update ADS creds too.
shueybubbles commented 1 year ago

We need to be extremely careful about modifying Azure Data Studio's settings file. It's not a documented format and there's no API. On Windows, it's possible to update the password in the credential manager if the lookup key for the new container is the same as the old one.

stuartpa commented 8 months ago

I debugged this, and have a fix (fix can currently be tested in #319, will factor it out of there into a separate PR)