Dynamic Configuration with Azure App Configuration

Published: (April 22, 2026 at 11:35 AM EDT)
2 min read
Source: Dev.to

Source: Dev.to

Cover image for Dynamic Configuration with Azure App Configuration

Azure App Configuration provides a service to centrally manage application settings and feature flags. Modern programs, especially programs running in a cloud, generally have many components that are distributed in nature.

In this post we look at dynamic configuration with Azure App Configuration and how labels can further increase the level of dynamism. Using labels allows you to provision environment‑specific settings in one place while using environment variables to retrieve per‑environment values. You can also create different profiles using labels—simply use a different key instead of the environment name.

Calling label‑specific configurations with .NET

First, add the package Microsoft.Extensions.Configuration.AzureAppConfiguration:

dotnet add package Microsoft.Extensions.Configuration.AzureAppConfiguration

Configure the connection to Azure App Configuration using an environment variable that holds the connection string:

var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddAzureAppConfiguration(options => {
    options.Connect(builder.Configuration.GetConnectionString("APPCONFIG_CONNECTION_STRING"))
           .Select(KeyFilter.Any, LabelFilter.Null)          // Load unlabelled settings
           .Select(KeyFilter.Any, "");       // Load settings with a specific label
});

The first Select loads all configurations without a label; the second loads those with the specified label.

For an environment‑based approach, you can use the current environment name:

var environment = builder.Environment.EnvironmentName;

Your configuration settings are then accessed through the normal IConfiguration interface.

You can also supply any label name (e.g., from a database or Redis cache) in the Select method to load a specific profile.

Calling label‑specific configurations with TypeScript

The same principles apply when using the JavaScript SDK, which works with React, Angular, etc. Install the package via npm:

npm install @azure/app-configuration

Import the client in your TypeScript file:

import { AppConfigurationClient } from "@azure/app-configuration";

Set up connection variables and the key you want to retrieve:

const connectionString = process.env["APPCONFIG_CONNECTION_STRING"] || "";
const client = new AppConfigurationClient(connectionString);

const configKey = "Samples:Endpoint:Url";
const labelKey = process.env["ENVIRONMENT"] || "Development";

Retrieve the configuration setting using the key and label:

const betaEndpoint = await client.getConfigurationSetting({
    key: configKey,
    label: labelKey
});
0 views
Back to Blog

Related posts

Read more »