Automated-Fact-Checking-Resources icon indicating copy to clipboard operation
Automated-Fact-Checking-Resources copied to clipboard

Update Serilog.Sinks.MSSqlServer.csproj to support the use of Managed Identities through the connectionstring

Open bk-td opened this issue 3 years ago • 2 comments

Updated package references to Microsoft.Data.SqlClient 3.0.0, doing so makes using the UseAzureManagedIdentity and AzureServiceTokenProviderResource no longer necessary to use when working with Managed Identities. The update package allows the Authentication parameter to be used in the connectionstring like this: "Server=xxxx;Database=xxxx;Authentication=Active Directory Managed Identity;"

bk-td avatar Sep 14 '21 14:09 bk-td

Hi @bk-td! Thank you for the contribution. This sounds like very good news.

Here is some relevant documentation on this topic: https://docs.microsoft.com/en-us/sql/connect/ado-net/sql/azure-active-directory-authentication?view=sql-server-ver15#using-active-directory-default-authentication

Do you know if we can use User Assigned Managed Identities with this without using an extra AzureServiceTokenProviderConnectionString (like used in PR #352)?

Have you tested MSSQL Sink with SqlClient 3.0.0 with Managed Identies? A working sample or some documentation would be highly appreciated, so I can test this before accepting this PR.

ckadluba avatar Sep 17 '21 22:09 ckadluba

Note: updating this also makes Microsoft.data work property side by side with System.data, versions below 2.1 cannot be used side by side on net framework when using AAD authentication using a custom sqlauthenticationprovider.

Relevant documentation for Microsoft.data is https://docs.microsoft.com/en-us/sql/connect/ado-net/sql/azure-active-directory-authentication?view=sql-server-ver15#customizing-active-directory-authentication for net framework see net472 release post for an example

#374

Daniel-Svensson avatar Jan 04 '22 12:01 Daniel-Svensson

I will close this long standing PR. We are currently upgrading SqlClient in PR https://github.com/serilog-mssql/serilog-sinks-mssqlserver/pull/418 and will remove the obsolete MS AppAuthentication soon and use SqlClient auth capabilities instead.

Thanks a lot for your input and research.

ckadluba avatar Sep 26 '22 06:09 ckadluba