Tiago Somda
Tiago Somda

Reputation: 144

is it possible to use Feature Management (feature flags) with Azure Functions?

I have been trying to use use feature flags with azure functions, but I can't seem to get the configuration correctly.

There is some documentation on how to get the configuration values, but nothing around feature management. https://learn.microsoft.com/en-us/azure/azure-app-configuration/use-feature-flags-dotnet-core

Upvotes: 1

Views: 725

Answers (1)

Satya V
Satya V

Reputation: 4174

Yes, It is possible !

ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
        configurationBuilder.AddAzureAppConfiguration(options =>
        {
            options.Connect(Environment.GetEnvironmentVariable("ConnectionString"))
                   // Load all keys that start with `TestApp:`
                   .Select("TestApp:*")
                   // Configure to reload configuration if the registered 'Sentinel' key is modified
                   .ConfigureRefresh(refreshOptions =>
                        refreshOptions.Register("TestApp:Settings:Sentinel", refreshAll: true)
                    )
                   // Indicate to load feature flags
                   .UseFeatureFlags();

Reference : https://github.com/Azure/AppConfiguration/blob/master/examples/DotNetCore/AzureFunction/FunctionApp/Startup.cs

You can obtain the instance of IFeatureManagerSnapshot & use it as part of your Azure Functions call.

Reference: https://github.com/Azure/AppConfiguration/blob/master/examples/DotNetCore/AzureFunction/FunctionApp/Startup.cs

Other references :

  1. Usage of Azure App Configuration's Feature Flags in Azure Functions
  2. https://github.com/MicrosoftDocs/azure-docs/issues/52234

Upvotes: 2

Related Questions