Azure SQL服务器支持AAD身份验证,我希望我的应用程序使用AAD身份验证而不是SQL Server管理员凭据连接到SQL Server。我正在使用EF Core连接到SQL,如何使EF Core使用AAD身份验证。
我的应用程序已部署在Azure App Service中,并且已启用MSI扩展,因此我很期待Microsoft.Azure.Services.AppAuthentication
用于从AAD获取令牌。
使用EF Core通过AAD身份验证连接到Azure SQL服务器
如果您的项目平台是.netcore,则not supported
当前为。我也在github上找到了这个问题。
所以我期待使用Microsoft.Azure.Services.AppAuthentication从AAD获取令牌
var azureServiceTokenProvider = new AzureServiceTokenProvider();
string accessToken = await azureServiceTokenProvider.GetAccessTokenAsync("https://management.azure.com/").ConfigureAwait(false);
更新:
感谢AlejandroC共享,.NET Core 2.2 Preview 1支持该功能,有关更多信息,请参阅.NET Core 2.2 Preview 1-2018年8月22日
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句