![](/img/trans.png)
[英]Local development access to Azure App Configuration with a managed identity
[英]Azure App Configuration to retrieve configuration values from c# Azure function via Managed Identity is not working
我已經創建了 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:在 Azure.Core.Pipeline.RetryPolicy。
請幫助我如何解決這個問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.