I'm programming automation to my CI/CD Gitlab to deploy my Azure Functions projects programmatically.
But I'm having an issue when I publish a new function to a function app created previously using az cli like the example below:
$ func azure functionapp publish $AZURE_APP_NAME ${SLOT_PARAMETER} ${FUNCTION_LANGUAGE} --nozip
$ az webapp config appsettings set -g $AZURE_RG_NAME -n $AZURE_APP_NAME ${SLOT_PARAMETER} --settings "WEBSITE_RUN_FROM_PACKAGE=0"
The command line shows that the new function was built, created and deployed successfully. But when I check if the new function was created in my app using the Azure Console UI nothing was shown.
I even tried deploying the function as a zip package using the default publish
command or like the example above using --nozip
and setting WEBSITE_RUN_FROM_PACKAGE=0
to deploy files.
It's strange because I could see the deployed function for another app function using the same script. In this way the behavior of the console UI function app seems erratic.
As was mentioned by @pravallika-kothaveerannagari I needed to enable SCM_DO_BUILD_DURING_DEPLOYMENT=true
during the deployment of my function to build it on the App Service.
Besides, I've changed the deployment of the function to az functionapp deployment source config-zip
, and not using Azure Function core tools anymore.
echo '[config] SCM_DO_BUILD_DURING_DEPLOYMENT = true' > .deployment
zip -r build.zip MyFunction
az functionapp deployment source config-zip -g $AZURE_RG_NAME -n $AZURE_APP_NAME ${SLOT_PARAMETER} --src build.zip