Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabled Azure Functions still running

I am just starting to test with Microsoft Azure Functions. I have my VS2017 publishing and my function is working nicely. I currently have one function that I am working with. It is set on a timer of every 5 minutes.

However, it appears that that function is executing even when I have it "disabled". This can be seen in the Monitor and in one of the systems that it is interacting with. The only way that I am able to stop it is to stop the overall function group. When I then start the function group, it starts the disabled function running every 5 minutes again.

Am I missing something? Does the disabling of an individual function have some other purpose?

How do I get an individual function within a function group to not execute on its defined schedule?

Thanks.

like image 855
Scot Sunnergren Avatar asked Feb 05 '23 04:02

Scot Sunnergren


1 Answers

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

like image 180
Naren Avatar answered May 14 '23 05:05

Naren