Skip to main content
net8.0

A client for Azure App Configuration that integrates with Aspire.

Published
Sep 2, 2025
1y ago
Total Downloads
849.0K
848,954

Deprecated Package Version

Reason: Other, Legacy

This version is out of support and is no longer maintained. Please upgrade to the latest version. See our support policy for details: https://aka.ms/dotnet/aspire/support

Install

dotnet add package Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration --version 9.4.2-preview.1.25428.12
ProductVersions
.NET
net8.0

README

Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration

Retrieves configuration settings from Azure App Configuration to use in your application. Registers Azure App Configuration service as a configuration source. Enables corresponding logging and telemetry.

Getting started

Prerequisites

Install the package

Install the .NET Aspire Azure App Configuration library with NuGet:

dotnet add package Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration

Usage examples

Add App Configuration to configuration

In the Program.cs file of your project, call the builder.Configuration.AddAzureAppConfiguration extension method to add key-values from Azure App Configuration to the application's Configuration. The method takes a connection name parameter.

builder.AddAzureAppConfiguration("appConfig");

You can then retrieve a key-value through normal IConfiguration APIS. For example, to retrieve a key-value from a Web API controller:

public MyController(IConfiguration configuration)
{
    string someValue = configuration["someKey"];
}
Use feature flags

To use feature flags, install the Feature Management library:

dotnet add package Microsoft.FeatureManagement

App Configuration will not load feature flags by default. To load feature flags, you can pass the Action<AzureAppConfigurationOptions> configureOptions delegate when calling builder.AddAzureAppConfiguration.

builder.AddAzureAppConfiguration(
    "appConfig",
    configureOptions: options => options.UseFeatureFlags());

// Register feature management services
builder.Services.AddFeatureManagement();

You can then use IVariantFeatureManager to evaluate feature flags in your application:

private readonly IVariantFeatureManager _featureManager;

public MyController(IVariantFeatureManager featureManager)
{
    _featureManager = featureManager;
}

[HttpGet]
public async Task<IActionResult> Get()
{
    if (await _featureManager.IsEnabledAsync("NewFeature"))
    {
        return Ok("New feature is enabled!");
    }

    return Ok("Using standard implementation.");
}

For information about using the Feature Management library, please go to the documentation.

Configuration

The .NET Aspire Azure App Configuration library provides multiple options to configure the Azure App Configuration connection based on the requirements and conventions of your project. Note that the App Config endpoint is required to be supplied, either in AzureAppConfigurationSettings.Endpoint or using a connection string.

Use a connection string

When using a connection string from the ConnectionStrings configuration section, you can provide the name of the connection string when calling builder.AddAzureAppConfiguration():

builder.AddAzureAppConfiguration("appConfigConnectionName");

And then the App Configuration endpoint will be retrieved from the ConnectionStrings configuration section. The App Configuration store URI works with the AzureAppConfigurationSettings.Credential property to establish a connection. If no credential is configured, the DefaultAzureCredential is used.

{
  "ConnectionStrings": {
    "appConfigConnectionName": "https://{store_name}.azconfig.io"
  }
}

Use configuration providers

The .NET Aspire Azure App Configuration library supports Microsoft.Extensions.Configuration. It loads the AzureAppConfigurationSettings from configuration by using the Aspire:Microsoft:Extensions:Configuration:AzureAppConfiguration key. Example appsettings.json that configures some of the options:

{
  Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration
  "Aspire": {
    "Microsoft": {
      "Extensions": {
        "Configuration": {
          "AzureAppConfiguration": {
            "Endpoint": "YOUR_APPCONFIGURATION_ENDPOINT_URI"
          }
        }
      }
    }
  }
}

Use inline delegates

You can also pass the Action<AzureAppConfigurationSettings> configureSettings delegate to set up some or all the options inline, for example to set App Configuration endpoint from code:

builder.AddAzureAppConfiguration("appConfig", configureSettings: settings => settings.Endpoint = "http://YOUR_URI");

AppHost extensions

In your AppHost project, install the Aspire Azure App Configuration Hosting library with NuGet:

dotnet add package Aspire.Hosting.Azure.AppConfiguration

Then, in the Program.cs file of AppHost, add a App Configuration connection and consume the connection using the following methods:

// Service registration
var appConfig = builder.AddAzureAppConfiguration("appConfig");

// Service consumption
var myService = builder.AddProject<Projects.MyService>()
                       .WithReference(appConfig);

The AddAzureAppConfiguration method adds an Azure App Configuration resource to the builder. Or AddConnectionString can be used to read connection information from the AppHost's configuration under the ConnectionStrings:appConfig config key. The WithReference method passes that connection information into a connection string named appConfig in the MyService project. In the Program.cs file of MyService, the connection can be consumed using:

builder.AddAzureAppConfiguration("appConfig");

Additional documentation

Feedback & contributing

https://github.com/dotnet/aspire

Changes from Previous Version

No structural changes between v9.4.1-preview.1.25408.4 and v9.4.2-preview.1.25428.12.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

This version is marked prerelease. Validate its API and upgrade path before production use.NuGet marks this package as deprecated. Review the publisher's migration guidance before adopting it.Compatibility metadata lists 1 target framework; confirm the exact target used by your application.The published metadata declares 14 direct dependency entries across framework groups. Inspect the resolved dependency graph for your target framework.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.