ThomasArdal
ThomasArdal

Reputation: 5259

Disable attribute doesn't work with Azure Functions

I'm trying to disable a Function app, by using the Disable attribute with an app setting:

[Disable("Disable")]
[FunctionName("MyFunction")]
public static void Run([TimerTrigger("0 0 8 * * *")]TimerInfo myTimer)

When compiling this function, the function.json looks like this:

{
    ...
    "disabled": "Disable",
    ...
}

On my function app on Azure, I've defined the following app setting:

enter image description here

But when looking at the functions in the function app, the function is still disabled:

enter image description here

I was expecting the function not to be disabled, since the value of the app setting is 0. I guess the function app is disabled if the value of the disabled field in json is true if not set to false?

Upvotes: 2

Views: 1077

Answers (2)

Mikhail Shilkov
Mikhail Shilkov

Reputation: 35154

This looks like portal UI issue to me. I created a Timer Function and followed your scenario. The function is shown as disabled in the portal, but it still runs on schedule.

If I change the setting from 0 to 1, it's still shown as disabled, but also doesn't run anymore.

Update (thanks to @ahmelsayed): See github issue (and related). UI only handles truthy values for that property, which should be fixed.

Upvotes: 3

Connor McMahon
Connor McMahon

Reputation: 1358

This is a known bug found here.

Upvotes: 1

Related Questions