SCM_DO_BUILD_DURING_DEPLOYMENT is set to false explicitly by Azure Cli

17.1k Views Asked by At

I am using Azure Cli in Jenkins build to deploy my nodejs azure functions to azure. I need Kudu to build the npm packages to reduce the deployment time on Jenkins side.

I have SCM_DO_BUILD_DURING_DEPLOYMENT = true in Azure Functions configurations but Azure Cli explicitly set it to false while deploying the artifacts! So the application will be left out without node_modules folder.

I am using command similar to the following:

az functionapp deployment source config-zip --src artifacts.zip --resource-group MyGroup --subscription MySubscription --name MyFunction --slot pre

Any idea how to fix it?

4

There are 4 best solutions below

3
On

It seems that there was a similar issue with a version regression in the past. Check out the issue around this: https://github.com/Azure/azure-cli/issues/11246

You can install Azure CLI 2.0.77 or 2.0.75 using pip and see if this issue is vanished:

pip install azure-cli==2.0.75

May be, this is an issue with a latest update.

2
On

Adding $env:SCM_DO_BUILD_DURING_DEPLOYMENT=true in my script solved this problem

0
On
0
On

I also faced this issue when using the az functionapp deployment source config-zip command. When this command is executed, the value of SCM_DO_BUILD_DURING_DEPLOYMENT set to true in the function app's application settings will be overridden and changed to false.

To prevent that, set the --build-remote flag to true.
E.g. az functionapp deployment source config-zip --src artifacts.zip --resource-group MyGroup --subscription MySubscription --name MyFunction --slot pre --build-remote true

https://learn.microsoft.com/en-us/cli/azure/functionapp/deployment/source?view=azure-cli-latest#az_functionapp_deployment_source_config_zip