Reputation: 2329
I have an azure API and an Azure function. When certain logic is passed into the API, I want it to disable the Azure function.
This post suggest disabling the function using environment variables. This works, but in my case, I cant disable this via manual intervention, I need the api to set this variable.
Is this possible ?
Upvotes: 2
Views: 1870
Reputation: 12538
Your options are somewhat limited and will entail modifying some files that will enable or disable your functions.
Fortunately, you can easily to this programmatically using the Kudu VFS API.
There are two files you can work with to disable or enable a function, offering you different approaches to support different patterns:
The host.json
file, located on the root of your function script files, exposes a functions
property, which is a string array that, when set, defines a functions white list. When this property is set, only the functions contained in this array will be enabled and loaded by the runtime.
You can find more information about that setting here.
Each function has a function.json
file that contains function metadata. This metadata supports a disabled
property that, when set to true, disables that function.
This gives you the ability to manage each function individually, which defaulting to loading all functions in the app, but you do end up having to manage more files.
You can find more information about this setting here.
Upvotes: 6