I am looking to disable and enable a azure function using feature flags. Any idea?
Can we disable azure function using feature flag
256 Views Asked by Sap_vr At
2
There are 2 best solutions below
0

I am looking to disable and enable a azure function using feature flags.
I believe we can do disabling and enabling the functions in an Azure Function Project using feature flags in the below process:
- We have REST APIs to disable the function programmatically in the Azure Function app where Mayank has given the REST API Link along with the MS Doc for more information and steps for how to use in Code in Q&A Forum.
- Feature Flags can be used programmatically also with the help of
Microsoft.Extensions.Configuration.AzureAppConfiguration
,Microsoft.FeatureManagement
packages.
Feature Manager instance should be kept in DI Class by using the FunctionsStartup
class.
There is a boilerplate code given by Microsoft on using the feature flags in Azure Functions to change the functionality in runtime.
You should have a look at https://learn.microsoft.com/en-us/azure/azure-functions/disable-function?tabs=portal#c-class-libraries which has a decorator for turning on or off functions without allowing them to be triggered.
edit: Here's an answer for what is supported with attributes: https://github.com/Azure/azure-functions-dotnet-worker/issues/312