Document how to disable a function in V2
"disabled" property in function.json is no longer valid in Functions V2. You can disable a function via portal:
This adds an app setting key: AzureWebJobs.FunctionName.Disabled value: true
We might want to expand this to a general documentation topic on disabling, that explains the different workflows that are possible and not possible based on whether its v1/v2 and whether its a VS authored function or not.
From my experience disabling compiled queue-triggered function in Azure Portal did not have any effect, we still had them running even after re-deployment.
Any joy on this? Would very much appreciate some clear guidelines, thanks
@AuroraBrignola the information above should be enough to unblock you, assuming you're asking about V2.
It would be great if functions generated by templates does not add this obsolete property.
{
"disabled": false,
"bindings": [
{
"authLevel": "function",
"type": "httpTrigger",
"direction": "in",
"name": "req"
},
{
"type": "http",
"direction": "out",
"name": "res"
}
]
}
Also, the documentation should not present this property on 2.X samples: https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook
I believe this has been improved - @ggailey777 to confirm
ping @ggailey777
Is this the article that was needed? How to disable functions in Azure Functions
Yes @ggailey777 thanks. Will close this issue.
Main documentation is still wrong at https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook.
This will be source of confusion for Func V2 users trying to disable a function using obsolete "disable" property.
At least, a disclaimer should be added somewhere, pointing to the new article regarding disabling functions.
Does this mean that I can't disable functions locally? Only globally?
I'm trying to debug a new function but when I run locally all my other functions run, which I don't really want. But I don't want to disable the deployed functions.
@ggailey777 can you take care of the docs issue?
@danielcrisp you can disable functions locally. You should use local.settings.json instead App Settings (as you would do in Azure) (Env vars might work also. Not tested)
It will be something along these lines (deprecated keys might be present. This file is some months old):
{
"IsEncrypted": false,
"Values": {
"APPINSIGHTS_INSTRUMENTATIONKEY": "...",
"FUNCTIONS_WORKER_RUNTIME": "node",
"AzureWebJobsStorage": "...",
"AzureWebJobs.myFuncNameHere.Disabled": true,
},
"ConnectionStrings": {
}
}
@craigshoemaker we probably have this same issue in all the binding reference articles that still show the disabled property.
@ggailey777 should we use an include file for this?
https://github.com/MicrosoftDocs/azure-docs-pr/pull/126055