There is currently not a good way to pass Azure SQL authentication tokens through EF Core initialization processes. A major obstacle has been lack of support for configuring async authentication delegate or similar in SqlClient. SqlAppAuthenticationProvider now offers a solution to avoid configuring tokens entirely, and addresses the async issue in a robust manner, but it is not available for ASP.NET Core.
I'd like to see NETSTANDARD2.0 and/or other NetCore-target compilation directives in the SqlAppAuthenticationProvider project. For example: https://github.com/syndicatedshannon/azure-sdk-for-net/commit/57e3dd6fea23d2cefcf04508dcbc5f88b7d221a0 (note this approach depends on the Microsoft.Data.SqlClient library, as opposed to System.Data.SqlClient).
The previously-explored alternatives specific to EFCore are discussed fairly thoroughly here:
https://github.com/aspnet/EntityFrameworkCore/issues/13261
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jaredmoo
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jaredmoo
Thank you for filing this issue and all the work you have done! I'm in SQL DB team, please bear with me while I find who has more expertise in SqlAppAuthenticationProvider so that we can make progress here.
@syndicatedshannon Thank you for your suggestion, but unfortunately it is currently not possible for SqlAppAuthenticationProvider to support NetCore due to critical dependencies that NetCore is missing, as you have pointed out. More specifically, SqlAppAuthenticationProvider has strong dependencies on the new SqlAuthenticationProvider functionality in System.Data.SqlClient that was introduced in .NET Framework 4.7.2, that allows it to be registered as an authentication provider through just a configuration change.
So the best way forward is to ensure continuing development into the feature parity between .NET and NetCore's SqlClient such that there could be a NetCore implementation of SqlAppAuthenticationProvider in the future. I will certainly pass your request along, as I would like to see this functionality in NetCore as well.
@nonik0 I'm sure you are correct and I'm overlooking something, but I expected you to cite a different obstacle, and don't understand the one did you cite.
I understood that the SqlClient track was being moved out to Microsoft.Data.SqlClient to permit more frequent updates, independent of System assembly releases. This specific functionality does currently have parity in that new track. EF Core 3.x is also dependent on that track. That's why my cheap hack shown in the diff above works. It looks like it should also support NetFX, being dependent on NETSTANDARD2.0.
So I don't understand your comment exactly as it's written. But again, I wouldn't be surprised to find I've overlooked or misunderstood a dependency somewhere. Or perhaps I misunderstand the nature of the Microsoft.Data.SqlClient track.
I had instead expected to hear that there were breaking changes in the move to Microsoft.Data.SqlClient, and they were WIP. Or that this new SqlClient has another breaking dependency.
@syndicatedshannon Thanks for your reply, and I apologize for not fully looking further into Microsoft.Data.SqlClient in my initial response. Based off this blog post, it looks like I may be wrong and you are correct here in regards to what parity currently exists.
Moving forward, I will allocate some time soon to investigate further and see what we can do to bring more feature parity for SqlAppAuthenticationProvider to .NET Core.
so if this change is made, how do you actually use it. I've seen how to do it in web.config but what's the asp.net core equivalent?
As an FYI--we will be considering this feature for a possible future release and will update this thread accordingly.
Hi!
Microsoft.Data.SqlClient will soon be supporting "Active Directory Managed Identity" authentication mode (WIP https://github.com/dotnet/SqlClient/issues/616) that'll apply to .NET Framework, .NET Core and .NET Standard without any customization/override needed.
Also System.Data.SqlClient (.NET Core) does not support AD authentication modes - making the override impossible, so transition to Microsoft.Data.SqlClient would be needed in any case.
Most helpful comment
so if this change is made, how do you actually use it. I've seen how to do it in web.config but what's the asp.net core equivalent?