I have a function app in Azure that has several functions defined. According to this document, I can use AzureCLI to disable a function in a function app. When I run az functionapp config appsettings set --name $functionAppName --resource-group $resourceGroupName --settings AzureWebJobs.myFunction.Disabled=true
it creates the name value pair in application settings as stated in the documentation, but the state of the function does not toggle according to the value I set. Is something else required to toggle the state of the function when I run the AzureCLI commmand?
According to the comments, the problem was solved. OP change the azure function runtime from 1.x to 2.x and then it can be disabled by running this command.
az functionapp config appsettings set --name $functionAppName --resource-group $resourceGroupName --settings AzureWebJobs.myFunction.Disabled=true
Update2:
For this problem, I confirmed with azure support team. They provided me with the response below:
They found the feature of az function app config part was released at Sep. 2018, and at that time runtime v1 was already quite out of date. So it is possible that the product team only develops for the runtime v2.
In a word, we can just do this operation on v2 and v3, or use Azure Portal UI.
While this does technically work, it doesn't solve the problem for those using runtime version 1 of Azure Function, even though the documentation states that it can be done. I think there is a bug and I filed it on github against azure cli, awaiting feedback. There are caveats to upgrading to runtime version 2.x. docs.microsoft.com/en-us/azure/azure-functions/…
Hi @AnthonyKlotz, may I know the runtime stack of your function. I found some information from the previous version of the document you provided. Please check this link. I have also update the answer with a screenshot for your reference, it mentioned "Functions 1.x" in the previous version document but removed the line in the latest version document.
We use C# functions. Looks like there was never support to toggle function state with Azure CLI on Azure functions runtime 1.x. Edit: looks like perhaps it could as long as the function.json had the reference to a application setting
Hi @AnthonyKlotz, I checked with azure support team about this issue. They respond me just now, I have updated my answer in "Update 2". Please check.
Okay, thanks. We have plans to upgrade our azure functions later. So we will just use the feature when we upgrade.