Stop azure azure function app programatically using C #

Sairam Ganji 46 Reputation points

HI Team,

I am trying to stop my function app inside itself on certain conditions.
I landed to below page.

Can you please elaborate how we can do below Security?
User's image

Is there any other way to stop function app?

I also read a function app can be disabled if "AzureWebJobs.disablefunction.Disabled" is set to true in Configuration Settings.
But issue here is I am not able to update "AzureWebJobs.disablefunction.Disabled" value in Configuration Settings through code in Function app.

Any inputs?

Thanks in advance,

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,605 questions
{count} votes

Accepted answer
  1. MayankBargali-MSFT 69,971 Reputation points

    @Sairam Ganji Thanks for reaching out. To disable the function please refer to the disable function document.

    You can leverage the Azure REST API to programmatically stop your azure function and to know more about the Azure REST API, authentication etc. please refer to this document.

    You can also use the below REST endpoint to enable/disable a particular function
    content-type: application/json; charset=utf-8

    Request Body:




    Alternative you can also use this API to update app setting on your function app.

    In case if you want to do it for your local environment then you can define below in your local.settings.json but when you deploy to azure then you need to define it in Application setting of your function app.

    "AzureWebJobs.yourfunctionname.Disabled": true  


    "AzureWebJobs.yourfunctionname.Disabled": 1  

    Feel free to get back to me if you need any assistance.

    Please 'Accept as answer' so that it can help others in the community looking for help on similar topics.

0 additional answers

Sort by: Most helpful