DevOps deployment of function app to flex consumption

Laura Cook 15 Reputation points
2025-01-23T10:03:11.3166667+00:00

Hello,

I have updated my old function app to use the flex consumption plan and I've updated the Azure Functions Deploy task in DevOps to have the flex consumption plan option marked as true, but when I run the deployment it says 'The Deployment Type option does not apply for Flex Consumption.' and does not attempt to upload my code.

User's image

User's image

Is there anything else that I need to change in the deployment task? It's currently trying to upload a zip that's created during the build. Is there a way for me to trigger OneDeploy instead of zip deploy in the task?

Many thanks

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,911 questions
{count} vote

3 answers

Sort by: Most helpful
  1. SchnellAlexander-9256 10 Reputation points
    2025-02-07T08:09:19.5633333+00:00

    Hi, I managed to deploy from a zip file to an Azure Flex Consumption Plan with an Azure DevOps pipeline based on a yaml file. Therefore I used the yaml code below for the deployment stage, which uses Azure CLI. During the build stage I archived the package in the directory below and published it in the following way. Note, that if you are using a private Python package location, you have to specify PIP_EXTRA_INDEX_URL in the correct way in the app setting of your Azure Function.

    #Publish package
    - publish: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
          artifact: drop
    
    $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip #Archive directory
    
    
    - stage: Deploy
      displayName: Deploy stage
      dependsOn: Build
      condition: succeeded()
      jobs:
        - deployment: Deploy
          displayName: Deploy
          environment: 'development'
          pool:
            vmImage: $(vmImageName)
    
          strategy:
            runOnce:
              deploy:
    
                steps:
                - task: AzureCLI@2
                  displayName: 'Deploy using az cli'
                  inputs:
                    azureSubscription: $(azureSubscription)
                    scriptType: 'bash'
                    scriptLocation: 'inlineScript'
                    inlineScript: |
                      echo "Deploying using OneDeploy"
                      az functionapp deployment source config-zip \
                        --resource-group $(resourceGroupName) \
                        --name $(functionAppName) \
                        --src $(Pipeline.Workspace)/drop/$(Build.BuildId).zip
    
    2 people found this answer helpful.

  2. Finbar Ryan 5 Reputation points Microsoft Employee
    2025-03-21T17:29:46.3633333+00:00

    Hello,

    I'm the maintainer of this DevOps task.
    The error message is misleading in that for this DevOps task we ignore the additional parameters for the Deployment Type which is set to Auto (Run From Zip) for the other Hosting plans we support. If the app is marked as Flex Consumption we log this error to say we are ignoring the provided Deployment Method. I will look to change this to avoid confusion. However if you see this message then we are in the code path for deploying to Flex and we should be calling /api/publish aka OneDeploy.

    If you're seeing this then we would need more logs with System.Debug enabled to see what's actually going on and offline I would be happy to investigate if you wanted to share site names and details.

    Just let me know,

    Finbar

    1 person found this answer helpful.
    0 comments No comments

  3. Khadeer Ali 5,990 Reputation points Microsoft External Staff Moderator
    2025-01-23T11:34:47.61+00:00

    @Laura Cook ,

    Welcome to Microsoft Q&A Platform!

    Thanks for reaching out. When you're deploying to the Azure Functions Flex Consumption plan, you can only use the One Deploy method. It looks like your current error is because your deployment is trying to use another method, probably zip deploy, which won't work here.

    To fix this, you'll need to tweak your Azure DevOps pipeline to use One Deploy. This means updating your deployment task to specify One Deploy and setting up a package source with the /onedeploy extension in your deployment config.

    If your pipeline is creating a zip file during the build, you'll need to make some changes to meet the One Deploy requirements. Usually, this means making the deployment package accessible to the Functions host and ensuring the settings are correctly configured.
    References:

    Hope this helps. Do let us know if you have any further queries.


    If this answers your query, do click Accept Answer and Yes for "Was this answer helpful." And if you have any further questions, let us know.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.