@amirkhansinga Thanks for reaching out. To disable the function please refer to the disable function document.
Programmatically you can also use the below REST endpoint to enable/disable a particular function
PUT https://management.azure.com/subscriptions/{subscriptionID}/resourceGroups/{resourcegroupname}/providers/Microsoft.Web/sites/{sitename}/functions/{functionappname}/properties/state?api-version=2018-11-01
content-type: application/json; charset=utf-8
Request Body:
{"properties":"disabled"}
OR
{"properties":"enabled"}
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
OR
"AzureWebJobs.yourfunctionname.Disabled": 1
Feel free to get back to me if you need any assistance.
Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.