小编Dyl*_*vis的帖子

Azure KeyVault:Azure.Identity.CredentialUnavailableException:DefaultAzureCredential 无法从包含的凭据中检索令牌

我正在尝试将面向 .net 框架的 aspnet 核心应用程序与 Azure Keyvault 连接起来。在支持身份的新 azure vm 上一切正常,但此应用程序托管在不支持身份的经典 azure vm 上。我创建了系统环境变量 AzureServiceAuthConnectionString,它可以分割其他带有 Azure 密钥库的 .net 框架应用程序已经在使用并且运行良好。

查看我的标准输出日志,我每次都会收到以下异常。

Azure.Identity.CredentialUnavailableException: DefaultAzureCredential failed to retrieve a token from the included credentials
EnvironmentCredential authentication unavailable. Environment variables are not fully configured
ManagedIdentityCredential authentication unavailable, the requested identity has not been assigned to this resource.
Run Code Online (Sandbox Code Playgroud)

我在启动时使用以下代码:

        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
            WebHost.CreateDefaultBuilder(args)               
       .UseApplicationInsights(ConfigurationManager.AppSettings["applicationInsightsInstrumentationKey"])
                .ConfigureKestrel(options => options.AddServerHeader = false)
                .UseIISIntegration()
                .ConfigureAppConfiguration((context, config) =>
                {
                    var vaultName = ConfigurationManager.AppSettings["VaultName"];
                    if (!string.IsNullOrEmpty(vaultName))
                    {
                        var …
Run Code Online (Sandbox Code Playgroud)

.net c# azure azure-keyvault asp.net-core

12
推荐指数
6
解决办法
2万
查看次数

标签 统计

.net ×1

asp.net-core ×1

azure ×1

azure-keyvault ×1

c# ×1