I followed the steps at https://docs.microsoft.com/en-us/azure/azure-app-configuration/quickstart-feature-flag-aspnet-core?tabs=core3x for getting a list of features. On my Home controller, if I call
var features = featureManager.GetFeatureNamesAsync();
I don't see any features. Although, I have features setup. I do see that the app configuration resource in Azure is getting hit.
So, here are the steps I've followed:
Created a new .NET Core MVC project targeting 3.1 (to eliminate the fact that .NET Core 5 may have issues)
Add the Microsoft.Azure.AppConfiguration.AspNetCore and Microsoft.FeatureManagement.AspNetCore NuGet packages
Update startup.cs > Configure > adding in app.UseAzureAppConfiguration();
Update startup.cs > ConfigureServices > adding in services.AddFeatureManagement();
In the Azure Portal, created a new Azure App Configuration resource in the free tier. Added a single feature called ShowAboutMe and set the value to On
In the resource, go to AccessKeys and copy the primary read only key
In my application, add a new key/value in appsettings.json called "AppConfigConnectionString" and set the value to the value I just copied.
In Program.cs > CreateHostBuilder > added the following:
Host.CreateDefaultBuilder(args) .ConfigureAppConfiguration((context, builder) => { var settings = builder.Build(); if (!string.IsNullOrEmpty(settings["AppConfigConnectionString"])) { builder.AddAzureAppConfiguration(options => { options.Connect(settings["AppConfigConnectionString"]); options.Select(KeyFilter.Any); options.UseFeatureFlags(); }); } }) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
In Controllers\HomeController.cs, changed the top part of the controller class to resemble this:
private readonly IFeatureManager _featureManager; private readonly ILogger<HomeController> _logger; public HomeController(ILogger<HomeController> logger, IFeatureManager featureManager) { _logger = logger; _featureManager = featureManager; } public IActionResult Index() { var features = _featureManager.GetFeatureNamesAsync(); return View(); }
Set a breakpoint on the return View() line in the Index method, executed, and checked the results of features.
When navigating, I only see this response: System.Collections.Generic.IAsyncEnumerator<string>.Current = null
Any ideas what I can be missing? I have tried .NET Core 5 MVC and .NET Core 5 Razor Pages applications as well with no luck.

