Disable the Azure property not working in Visual Studio 2017

I have an Azure function with a timer trigger.

public static void Run([TimerTrigger("0 */15 * * * *"), Disable("True")]TimerInfo myTimer, TraceWriter log)

It Disable("true")doesn’t work here. it generates function.jsonlike "disabled": "True",that is wrong. This should be "disabled": True, Disable only accepts a string value. Is there any way to change this? or any other way to disable the function?

+5
source share
4 answers

Disable default properties true.

Use Disable()instead Disable("true").

So the code will look like

public static void Run([TimerTrigger("0 */15 * * * *"), Disable()]TimerInfo myTimer, TraceWriter log).

If you want to enable the function, use Disable("False").

+6
source

host.json ? , , .

// Array of functions to load. Only functions in this list will be enabled.
// If not specified, all functions are enabled.
"functions": ["QueueProcessor", "GitHubWebHook"]

, -, host.json (.. host.json)

: https://github.com/Azure/azure-webjobs-sdk-script/wiki/host.json

+2

- "": "true" . , .

.

public static void Run([TimerTrigger("0 */5 * * * *"),Disable("true")]TimerInfo myTimer, TraceWriter log)

Azure.

enter image description here

+1

2.x local.settings.json

{
    "IsEncrypted": false,
    "Values": {
    "AzureWebJobs.MyFunctionNameOne.Disabled": "true",
    "AzureWebJobs.MyFunctionNameTwo.Disabled": "true",
    ...
    }
}

Link: https://docs.microsoft.com/en-us/azure/azure-functions/disable-function#functions-2x---all-languages

0
source

Source: https://habr.com/ru/post/1683938/


All Articles