Created as part of this blog post: https://www.oettle.me/blog/targeted-feature-flags
This project demonstrates feature flag management in a .NET 9.0 Web API using Azure App Configuration and Microsoft.FeatureManagement. It supports user targeting and dynamic feature control.
- .NET 9.0 SDK
- Azure Developer CLI (azd)
- (Optional) Visual Studio 2022+ or VS Code
This project uses Azure Developer CLI (azd) to provision all required Azure resources—including App Configuration—automatically.
git clone https://github.com/<your-org>/feature_flags.git
cd feature_flagsaz loginazd upThis command will:
- Provision all required Azure resources (App Configuration, etc.)
- Deploy the application
- Output endpoints and connection info
cd src/FeatureFlagApi
pwsh
dotnet restore
dotnet runThe API will start on https://localhost:5001 (or as configured).
GET /feature-flag— Returns if theDemofeature is enabled for the current user.GET /enabled-flags— Lists all enabled feature flags for the current user.
User targeting is implemented via DemoTargetingContextAccessor and UserService. You can customize user/group logic in these files.
- Ensure you have run
azd upand resources are provisioned. - For more info, see Microsoft Learn: Feature Management.