Implementing Feature Flags with Azure App Configuration
This lesson explains Feature Manager, flag types and filters, and how an application reads them.
Learning outcomes
After completing this lesson, you will be able to:
- Describe Azure App Configuration concepts.
- Distinguish switch, rollout and experiment flags.
- Choose a feature filter.
- Manage flags from a pipeline.
Azure App Configuration fundamentals
Azure App Configuration is a managed service for application settings and feature flags. Rather than storing values in each application's configuration files, teams keep them in a central store. An item is a key-value, and an optional label distinguishes versions of a key, for example by environment. Applications read values at start-up, and they can refresh at intervals, so a change takes effect without a redeployment.
App Configuration holds settings and not secrets. A Key Vault reference can point to a secret in Azure Key Vault, and the application resolves it, so the two services work together. Access should use Microsoft Entra ID and a managed identity, with roles such as App Configuration Data Reader.
App Configuration basics
Feature Manager
Feature Manager is the portal interface for creating and managing feature flags. Internally, a flag is a key-value with the prefix .appconfig.featureflag/ and a special content type. Microsoft describes three scenarios for a flag.
Switch
A switch is on or off for everyone. It suits a kill switch, which turns off a feature during an incident, or a release decision made by a product owner.
Rollout
A rollout exposes a feature gradually. An audience can combine a default percentage with named groups and users. Conditions add a schedule or custom rules.
Experiment
An experiment uses variants: named values, such as button colours, each with a traffic share. The shares must total 100%, and overrides can assign a variant to particular users or groups. Sending telemetry to Application Insights lets a team measure results, and metric scorecards for analysing impact are in preview at the time of writing.
Switch, rollout or experiment?
Feature filters
A feature filter decides whether a flag is enabled for a given request. Filters allow a flag that is switched on to apply only under certain conditions. There are three built-in kinds.
- The targeting filter enables a feature for named users and groups, and for a percentage of the rest. Assignment is consistent, so a user keeps the same experience across requests.
- The time window filter enables a feature between a start time and an end time, which suits a timed launch.
- A custom filter applies your own logic, such as a browser type or a subscription tier.
When a flag has several filters, the Require all feature filters to be enabled option decides how they combine: checked means that all must pass, and unchecked means that any one may pass.
The following diagram shows who sees a new checkout feature behind a feature flag with a targeting filter.

Choosing a feature filter
Managing flags from a pipeline
Flags can be managed as code. The Azure CLI creates and changes them, which allows a pipeline to enable a flag as a final release step.
# Create a disabled flag
az appconfig feature set --name appcs-contoso --feature NewCheckout --label production --yes
# Turn it on for production
az appconfig feature enable --name appcs-contoso --feature NewCheckout --label production --yes
# Add a percentage rollout
az appconfig feature filter add --name appcs-contoso --feature NewCheckout --label production \
--filter-name Microsoft.Targeting \
--filter-parameters Audience='{"Users":[],"Groups":[],"DefaultRolloutPercentage":10}' --yesAzure Pipelines has tasks for importing from and exporting to a store, and a declarative file in the repository can hold key-values, which brings configuration under source control.
Reading flags in an application
Applications use the feature management libraries, available for .NET, Java, Python, JavaScript and Go. In ASP.NET Core, the application connects to the store with a managed identity, and code asks a feature manager whether a feature is enabled.
builder.Configuration.AddAzureAppConfiguration(options =>
{
options.Connect(new Uri(endpoint), new DefaultAzureCredential())
.UseFeatureFlags(flags => flags.SetRefreshInterval(TimeSpan.FromMinutes(1)));
});
builder.Services.AddAzureAppConfiguration();
builder.Services.AddFeatureManagement();
// In a controller or page
if (await featureManager.IsEnabledAsync("NewCheckout"))
{
return View("CheckoutV2");
}
return View("Checkout");The refresh interval is a design choice. A short interval makes a kill switch take effect sooner, while a long one reduces calls to the service. The default for feature flags is 30 seconds in the provider libraries, so a change is not seen instantly.
How fast does a flag change apply?
Lifecycle of a flag
Flags are temporary, unless they are long-lived operational switches. The following sequence describes a healthy lifecycle.
-
Add
Create the flag, disabled, and add a code path.
-
Deploy
Ship the code to production with the feature off.
-
Expose
Enable it for internal users, then a percentage.
-
Complete
Reach 100% and confirm stability.
-
Remove
Delete the flag and the old code path, so that no technical debt remains.
A flag from start to finish
A gradual launch
A team wants to enable a new checkout for internal staff immediately, then for 10% of customers, and to disable it in under a minute if errors rise. The application runs on App Service. What should you recommend?
Use a feature flag in Azure App Configuration with a targeting filter, listing the staff group and a default percentage of 10. Disabling the flag stops the feature without a deployment, and a short refresh interval meets the one-minute need. A slot with traffic routing also gives a percentage, but it cannot target a staff group easily, and rollback changes routing, not behaviour. An environment variable requires an app restart.
Should App Configuration hold a database password?
Show answer
No. It holds settings, so the password belongs in Key Vault, and App Configuration can hold a reference to it.
Exam Tips
Remember for the exam
- Feature Manager is the App Configuration interface for flags.
- Flag scenarios are switch, rollout and experiment.
- The targeting filter uses users, groups and a percentage; the time window filter uses dates.
- Flags are stored as key-values with the .appconfig.featureflag/ prefix.
- Delete a flag and its old code path after a full rollout.