Invoke-SqlCmd2 icon indicating copy to clipboard operation
Invoke-SqlCmd2 copied to clipboard

Azure Functions Managed Identity: Keyword not supported: 'authentication'

Open Szeraax opened this issue 2 years ago • 0 comments

When using a AZ Function MI, you need to use a connection string like: Server=a.database.windows.net; Authentication=Active Directory Managed Identity; Database=a but I get the error from AZ: Keyword not supported: 'authentication'.

Supposedly the fix is to use Microsoft.Data.SqlClient instead of System.Data.SqlClient. https://gist.github.com/MartinHBA/86c6014175758a07b09fa7bb76ba8e27

Perhaps Invoke-SqlCmd2 should detect if it has the Authentcation in the connection string and use MS.Data.Sql instead? Dunno.

More info: https://devblogs.microsoft.com/dotnet/introducing-the-new-microsoftdatasqlclient/

Shame that for lightweight query access, I have to revert to users and password. Or use dbatools.

Szeraax avatar Apr 03 '23 23:04 Szeraax