Can we disable azure function using feature flag

258 Views Asked by At

I am looking to disable and enable a azure function using feature flags. Any idea?

2

There are 2 best solutions below

1
On

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

0
On

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:

  1. 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.
  2. 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.