How to Enable/Disable Azure Function programmatically

后端 未结 5 767
南方客
南方客 2020-12-11 05:25

Is there a way to programmatically enable/disable an Azure function?

I can enable/disable a function using the portal under the \"Manage\" section, which causes a r

5条回答
  •  一生所求
    2020-12-11 06:01

    No, this is not possible currently. The disabled metadata property in function.json is what determines whether a function is enabled. The portal just updates that value when you enable/disable in the portal.

    Not sure if it will meet your needs, but I'll point out that there is also a host.json functions array that can be used to control the set of functions that will be loaded (documented here). So for example, if you only wanted 2 of your 10 functions enabled, you could set this property to an array containing only those 2 function names (e.g. "functions": [ "QueueProcessor", "GitHubWebHook" ]), and only those will be loaded/enabled. However, this is slightly different than enable/disable in that you won't be able to invoke the excluded functions via the portal, whereas you can portal invoke disabled functions.

提交回复
热议问题