go-sqlcmd icon indicating copy to clipboard operation
go-sqlcmd copied to clipboard

Add support for Azure AD device code authentication

Open maskati opened this issue 2 years ago • 4 comments

Currently --authentication-method supports ActiveDirectoryInteractive which uses azidentity.InteractiveBrowserCredential. This limits usage to windowed environments with a web browser.

Consider supporting a new authentication method ActiveDirectoryDeviceCode which would use azidentity.DeviceCodeCredential.

maskati avatar Aug 15 '23 18:08 maskati

thx for opening an issue! We need to add this method to the driver first.

shueybubbles avatar Aug 15 '23 19:08 shueybubbles

Now that i think about it, even better would be support for AzureCliCredential, which would allow using an ambient Azure CLI authenticated context (which supports device code authentication) in an SSO manner. Support for this would mean no need to authenticate sqlcmd at all if Azure CLI was already authenticated, which it often is. Should this be a separate request?

maskati avatar Aug 15 '23 20:08 maskati

--authentication-method ActiveDirectoryDefault includes AzureCliCredential in the search

shueybubbles avatar Aug 15 '23 22:08 shueybubbles

@shueybubbles great! I didn’t notice that since i assumed ActiveDirectoryDefault was a combination of the other methods directly supported by go-sqlcmd rather than those supported by azidentity.

maskati avatar Aug 16 '23 05:08 maskati

Are you going to solve this?

farshid3003 avatar Aug 27 '24 20:08 farshid3003

we added azcli and device code here https://github.com/microsoft/go-sqlcmd/commit/0a4cd1949a9ff220649a4f7bd0d9f775488df8e1#diff-8b63f3c9b8211c5793c8ac1aa5113aae3858130effb2401bcb8364e8664ce62d

shueybubbles avatar Aug 28 '24 15:08 shueybubbles