1
votes

I can connect to Azure App Configuration using a connection string from my framework 4.7.2 app.
I want to connect with a managed identity instead, but there is no

ConnectWithManagedIdentity("https://YOUR_ENDPOINT.azconfig.io")

method found on the options when adding

AddAzureAppConfiguration(options => { ... });

as seen in many netcore samples e.g. (page search: Authenticate with Managed Identity, and no label) https://zimmergren.net/introduction-azure-app-configuration-store-csharp-dotnetcore/

I create a builder

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.AzureAppConfiguration;
using ConfigurationBuilder = Microsoft.Extensions.Configuration.ConfigurationBuilder;

private static IConfiguration _configuration = null;

static void Main(string[] args)
{
    var builder = new ConfigurationBuilder();
    builder.AddAzureAppConfiguration(options =>
    {
        // options.ConnectWithManagedIdentity("https://YOUR_ENDPOINT.azconfig.io")
        options.Connect(Environment.GetEnvironmentVariable("ConnectionString"))

    });

    _configuration = builder.Build();

}

This line does not compile

options.ConnectWithManagedIdentity("https://YOUR_ENDPOINT.azconfig.io")

If I inspect the options object (AzureAppConfigurationOptions) I cannot see anything that looks related to Managed Identities when creating a connection.

Is there an additional nuget package I must add?

Any ideas?

1

1 Answers

0
votes

This solution is to use this syntax

 options.Connect(new Uri("https://YOUR_ENDPOINT.azconfig.io"), new ManagedIdentityCredential())

instead of

options.ConnectWithManagedIdentity("https://YOUR_ENDPOINT.azconfig.io")