False azure function status on azure portal
There are 2 ways in which an azure function can be created, one from the portal itself and other through SDK for example .NET SDK using which you could create functions and deploy the function to azure from Visual Studio.
Problem Scenario : When we deploy it from Visual Studio, the functions are deployed in a pre-compiled state and so we are not able to ENABLE or DISABLE the function from the portal itslef.
Solution suggested by Azure Support : Have an application setting on the portal which will be set to true/false or 1/0 which will enable/disable the azure function. Note : This setting has to be added in the code before deployment.
PORTAL BUG : If the azure functions are enabled using the application setting value and is set to disable and then deployed for the very first time, the portal will show the status as disabled which is fine. At a later stage if we change the value of app setting to true or 1, the portal still shows the status as disabled. NOTE : ON BACKEND, THE AZURE FUNCTION IS ENABLED AND RUNNING.
Conclusion : These portal false statuses creates a problem in analyzing the function runs/triggers to newbies.
We are revising the APIs used for detecting enablement status to give the portal a single source of truth. This should address this issue.
I ran into this problem recently, we are very lucky the function didn’t pose a critical problem while running in a “disabled” state. The functionality here is counter intuitive and only discoverable through direct experience or happening across the documentation (https://docs.microsoft.com/en-us/azure/azure-functions/disable-function#functions-1x---c-class-libraries ).
A warning in the Azure portal when trying to disable a Version ~1 C# function would have been enough to avoid the problem