skip to Main Content

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.

2

Answers


  1. Chosen as BEST ANSWER

    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
    

  2. When you are doing continuous deployments for the Azure Function App, you have to enable one of the configuration settings in the Azure Portal Function App > Configuration Menu i.e., SCM_DO_BUILD_DURING_DEPLOYMENT=true.

    az functionapp config appsettings set --name PravuFunctionApp 
    --resource-group PraviRG 
    --settings SCM_DO_BUILD_DURING_DEPLOYMENT=true
    

    After configuring this setting, then deploy using az cli command or function core tools command func azure functionapp publish, it will show the Functions in the Azure Portal Function App.

    Refer to this SO Thread regarding the similar issue i.e., No Functions showing after deployment/publishing.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search