A quick word from me
This issue isn't sponsored - I write these deep dives in my free time and keep them free for everyone. If your company sells AI tools, dev tools, courses, or services that .NET developers would actually use, sponsoring an issue is the most direct way to reach them.
Want to reach thousands of .NET developers? Sponsor TheCodeMan →This issue is made possible thanks to JetBrains, who help keep this newsletter free for everyone. A huge shout-out to them for their support of our community. Let's thank them by entering the link below. Struggling with slow builds, tricky bugs, or hard-to-understand performance issues? dotUltimate fixes all of that. It’s the all-in-one toolbox for serious .NET developers. 👉 Upgrade your .NET workflow.
How do you enable or disable features without redeploying the app?
If your first thought is “I’ll just flip a value in appsettings.json” - you’re not alone. But that’s also where most Feature Flag implementations quietly fail.
In the last few days, I shared a short post about Feature Flags in .NET, and the comments were exciting.
They all circled the same confusion:
Do we really avoid redeployment? How does this work with multiple instances? Is appsettings.json enough? Do I still need to run a DevOps release?
Let’s clear this up - with real code that actually works.
Let’s be very explicit.
“Without redeploying” means:
✅ behavior changes while the app is running
If changing a feature flag requires you to click 'Deploy', then you haven’t decoupled deployment from release - you've just moved the toggle.
Yes, you can define feature flags in appsettings.json.
{ "FeatureManagement": { "BetaFeature": true }}
But here’s the problem:
But it does not work for:
To truly avoid redeployment, feature flags must live outside the application.
Feature Flags must be:
These give us:
dotnet add package Microsoft.FeatureManagement.AspNetCoredotnet add package Microsoft.Azure.AppConfiguration.AspNetCore
In Azure Portal:
In appsettings.json:
{ "AzureAppConfig": { "ConnectionString": "<YOUR_CONNECTION_STRING>" }}
In real projects, this belongs in Key Vault or environment variables.
This is the part most examples skip or oversimplify.
using Microsoft.FeatureManagement;using Microsoft.Extensions.Configuration.AzureAppConfiguration; var builder = WebApplication.CreateBuilder(args); // 1. Connect to Azure App Configurationbuilder.Host.ConfigureAppConfiguration(config =>{ var settings = config.Build(); config.AddAzureAppConfiguration(options => { options .Connect(settings["AzureAppConfig:ConnectionString"]) // Register feature flags .UseFeatureFlags(featureOptions => { featureOptions.CacheExpirationInterval = TimeSpan.FromSeconds(10); }) // Register refresh with a sentinel key .ConfigureRefresh(refresh => { refresh .Register("FeatureFlags:Sentinel", true) .SetCacheExpiration( TimeSpan.FromSeconds(10)); }); });}); // 2. Add Feature Managementbuilder.Services.AddFeatureManagement(); // 3. Add Azure App Config refresh middlewarebuilder.Services.AddAzureAppConfiguration(); var app = builder.Build(); // Enable refresh middlewareapp.UseAzureAppConfiguration(); app.MapGet("/", () => "Feature Flags Demo is running"); // Feature-gated endpointapp.MapGet("/beta", async (IFeatureManager featureManager) =>{ if (await featureManager.IsEnabledAsync("BetaFeature")) { return Results.Ok("Beta feature is ENABLED"); } return Results.Ok("Beta feature is DISABLED");}); app.Run();
In Azure App Configuration:
Create a key-value pair:
Whenever you update this value:
Run the app and call GET /beta → ❌ disabled Enable BetaFeature in the Azure Portal Wait ~10 seconds Call /beta again → 🚀 enabled
No redeploy. No restart. No pipeline.
Azure App Configuration does cache values.
If you don’t configure refresh:
That’s why:
matter a lot.
This is where most “Feature Flags don’t work” stories come from.
This setup works perfectly with:
Azure App Configuration is great if you’re already on Azure.
Other solid options:
The provider matters less than the runtime architecture.
Feature Flags are powerful - but dangerous if abused:
Feature Flags are not about hiding code paths.
hey are about decoupling deployment from release.
If flipping a flag requires a redeploy, you didn’t gain flexibility - you added complexity.
If you want a deeper dive, I’ve already written a full article on Feature Flags in .NET with Azure Feature Management here.
More real-world .NET architecture topics coming soon 🚀 That's all from me for today.
Want to enforce clean code automatically? My Pragmatic .NET Code Rules course shows you how to set up analyzers, CI quality gates, and architecture tests - a production-ready system that keeps your codebase clean without manual reviews. Or grab the free Starter Kit to try it out.
Stop arguing about code style. In this course you get a production-proven setup with analyzers, CI quality gates, and architecture tests — the exact system I use in real projects. Join here.
Not sure yet? Grab the free Starter Kit — a drop-in setup with the essentials from Module 01.
Design Patterns that Deliver — Solve real problems with 5 battle-tested patterns (Builder, Decorator, Strategy, Adapter, Mediator) using practical, real-world examples. Trusted by 650+ developers.
Just getting started? Design Patterns Simplified covers 10 essential patterns in a beginner-friendly, 30-page guide for just $9.95.
Every Monday morning, I share 1 actionable tip on C#, .NET & Architecture that you can use right away. Join here.
Join 20,000+ subscribers who mass-improve their .NET skills with actionable tips on C#, Software Architecture & Best Practices.