Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration 9.3.0-preview.1.25265.20

Prefix Reserved
This is a prerelease version of Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration --version 9.3.0-preview.1.25265.20
                    
NuGet\Install-Package Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration -Version 9.3.0-preview.1.25265.20
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration" Version="9.3.0-preview.1.25265.20" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration" Version="9.3.0-preview.1.25265.20" />
                    
Directory.Packages.props
<PackageReference Include="Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration --version 9.3.0-preview.1.25265.20
                    
#r "nuget: Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration, 9.3.0-preview.1.25265.20"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration&version=9.3.0-preview.1.25265.20&prerelease
                    
Install Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration as a Cake Addin
#tool nuget:?package=Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration&version=9.3.0-preview.1.25265.20&prerelease
                    
Install Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration as a Cake Tool

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.

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

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
9.3.1-preview.1.25305.6 224 6/10/2025
9.3.0-preview.1.25265.20 854 5/19/2025