0
votes

I have created Azure App configuration and sets Key and value pairs. I have also created a HTTP Azure function via VS 2019 and write below code.

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());

Enable System assigned Identity of Azure Function. The identity I am using via ManagedIdentityCredential is assigned to both the Azure App Configuration Data Reader and Azure App Configuration Data Owner roles. But above my code is not working Azure portal. I have capture the error via log information.

Error message :Retry failed after 3 tries. (No such host is known.) (No such host is known.) (No such host is known.)Source=Azure.CoreStackTrace:at Azure.Core.Pipeline.RetryPolicy.

Please help on this how do I resolve the issue.

1
It seems your URI endpoint is incorrect or Managed Identity does not have App Configuration Data Reader role.singhh-msft
Any update now? If it helps you ,please accept it as answer.Joey Cai

1 Answers

0
votes

I test in my site with your code and it works very well. enter image description here

Go to azure app configuration and double check that you have assign Azure App Configuration Data Reader to the function's Identity.

enter image description here

And the output screenshot is as below:

enter image description here