The disable-function-if-exists.template.yml
below is a sample Azure DevOps YAML pipeline template
that can be used to disable an Azure Function if it exists.
In some deployment scenarios you may need to disable an Azure Function, such as a queue triggered function, before deploying down stream resources. The function to be disabled may not exist the first time the deployment pipeline is run in a particular environment, so the template checks for its existance before attempting to disalbe it.
https://docs.microsoft.com/en-us/azure/azure-functions/disable-function
Describes the recommended way to disable a function by setting the AzureWebJobs.<FUNCTION_NAME>.Disabled
app setting to true
in the containing function app.