我已经创建了 Azure 应用配置并设置了键值对。我还通过 VS 2019 创建了一个 HTTP Azure 函数并编写了以下代码。
using Microsoft.Extensions.Configuration;
using Azure.Identity;
var config = new ConfigurationBuilder().AddAzureAppConfiguration(options =>
{
options.Connect(new Uri("https://xxx-xxx-azf-global-parameters.azconfig.io"),
new ManagedIdentityCredential());
}).Build();
string str = config["AzfApp:Cloud"].ToString();
log.LogInformation("AzfApp:Cloud:" + config["AzfApp:Cloud"].ToString());
启用系统分配的 Azure 功能标识。我通过 ManagedIdentityCredential 使用的身份被分配给 Azure 应用程序配置数据读取者和 Azure 应用程序配置数据所有者角色。但上面我的代码无法正常工作 Azure 门户。我已经通过日志信息捕获了错误。
错误消息:3 次尝试后重试失败。(不知道这样的主机。)(不知道这样的主机。)(不知道这样的主机。)Source=Azure.CoreStackTrace:at Azure.Core.Pipeline.RetryPolicy。
请帮助解决这个问题。