'Stop a slot in Azure Function

Is there is a way to stop a slot (staging) that has been created for a function app using app setting?

enter image description here



Solution 1:[1]

I think what you are looking for is the app service stop azure rest api or the function stop command for cli for slots, either should work in this scenario, I'm unaware of an app setting that will disable a slot. You can have app settings that can disable the slots functions, but i don't believe there is an app setting to disable the site like this. Below are some references for other ways to stop a slot:

Example:
az functionapp stop --name MyFunctionApp --resource-group MyResourceGroup --slot slotname

Additonally thre is the rest api which should be able to stop this as well and you can run via the below link or postman

Example:
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/stop?api-version=2021-02-01


Note: For the rest api, make sure you use the slot name i.e. -slotname in the above url. for your example it would be "something-staging"

Hope this helps.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tspring