Disabled Azure Functions still running Disabled Azure Functions still running azure azure

Disabled Azure Functions still running


What you are experiencing is an expected behavior though not an ideal one. It is a bug in the portal experience.

The Function runtime directly consumes metadata in the binary files of the pre-compiled functions. Here is sample of annotation for the disabled function.

[TimerTrigger("0 */5 * * * *"), Disable()]

This is the function.json generated by visual studio the above annotations.

{"generatedBy": "Microsoft.NET.Sdk.Functions.MSBuild-1.0.2",  "configurationSource": "attributes",  "bindings": [    {      "type": "timerTrigger",      "schedule": "0 */5 * * * *",      "useMonitor": true,      "runOnStartup": false,      "name": "myTimer"    }  ],  "disabled": true,  "scriptFile": "..\\bin\\FunctionApp3.dll",  "entryPoint": "FunctionApp3.Function1.Run"}

The function.json generated by the precompiled functions is consumed by the portal and that is what is shown in the portal. When you change the disabled state of the function in the portal the disabled property is changed in the function.json but it is not consumed by the functions runtime. Hence it continues to execute.

When you deploy it in disabled state, runtime is aware of it and honors it as expected.

I have opened this bug to fix the portal experience.https://github.com/Azure/azure-functions-ux/issues/1857


Today, I got the same problem, and after to disable the function in Azure, I recommend you to restart the Function service. Because the Azure needs to refresh the metadata, and the restart is one of the solutions to accomplish it.