Azure-Functions icon indicating copy to clipboard operation
Azure-Functions copied to clipboard

How to deploy Flex Consumption function from zip file?

Open xperiandri opened this issue 1 year ago • 2 comments

There is no documentation at all on how to deploy Flex Consumption from CI. Can you fill that gap???

xperiandri avatar Jun 16 '24 17:06 xperiandri

@pragnagopa, @nzthiago, @alexkarcher-msft Could you, please, comment on this?

Juriyx avatar Jul 03 '24 21:07 Juriyx

We want to deploy them from the Azure DevOps CI pipeline

xperiandri avatar Jul 03 '24 22:07 xperiandri

Hi @xperiandri - sorry I missed this question. The support for the Functions task for Azure DevOps is still under way, being implemented by @FinVamp1. The current workaround would be to deploy the zip file using the AZ CLI task, with the following command:

az functionapp deployment source config-zip -g <resourceGroup> -n <functionAppName> --src <pathToZipFile>

nzthiago avatar Jul 05 '24 21:07 nzthiago

It works, thank you very much!

xperiandri avatar Aug 08 '24 09:08 xperiandri

FYI - Flex Consumption is now supported by the Azure DevOps task. See the isFlexConsumption option for the Azure Functions Deploy v2 task https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/azure-function-app-v2?view=azure-pipelines

nzthiago avatar Aug 08 '24 21:08 nzthiago

I followed the same steps as mentioned in the docs and added a task in azure pipeline for flex consumption with isFlexConsumption: true. It shows the deploy task as succeeded however the deployment is not done. No functions are being shown in the list on azure function app. When i check the logs from azure devops pipeline, it has the following logs:

The Deployment Type option does not apply for Flex Consumption. Successfully added release annotation to the Application Insight

Shubham-Isol avatar Feb 28 '25 05:02 Shubham-Isol

Post you task YAML

xperiandri avatar Mar 03 '25 02:03 xperiandri

I am facing the same issue. This is my YAML.

AzureFunctionApp@2 deployment

- task: AzureFunctionApp@2
            displayName: 'Deploy Function App'
            inputs:
              azureSubscription: ${{ parameters.azureSubscription }}
              appType: 'functionAppLinux'
              isFlexConsumption: true
              appName: ${{ parameters.appName }}
              package: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip

Error:

Starting: Deploy Function App
==============================================================================
Task         : Azure Functions Deploy
Description  : Update a function app with .NET, Python, JavaScript, PowerShell, Java based web applications
Version      : 2.247.1
Author       : Microsoft Corporation
Help         : https://aka.ms/azurefunctiontroubleshooting
==============================================================================
Got service connection details for Azure App Service:'xxx'
The Deployment Type option does not apply for Flex Consumption.
App Service Application URL: http://xxx.azurewebsites.net/
Finishing: Deploy Function App

ryanshirley-flipdish avatar Mar 04 '25 11:03 ryanshirley-flipdish

Its working on my side now. The problem was with a missing file. I use a db certificate which only present on local and was not pushed to git. So provided the file by downloading and including in zip on pipeline execution.

Shubham-Isol avatar Mar 04 '25 11:03 Shubham-Isol

Facing issue : The Deployment Type option does not apply for Flex Consumption.

Below is yaml using Azure Function App V2 task in azure devops pipeline.

steps:

  • task: AzureFunctionApp@2 displayName: 'Deploy API' inputs: connectedServiceNameARM: ServicePrinciple appType: functionAppLinux isFlexConsumption: true appName: 'smaapi' package: '$(System.DefaultWorkingDirectory)/API/Artifact_LatestBuild/package.zip'

amarpandharpure-eaton avatar Mar 31 '25 09:03 amarpandharpure-eaton

@amarpandharpure-eaton see @FinVamp1 reply here: https://learn.microsoft.com/en-us/answers/questions/2150637/devops-deployment-of-function-app-to-flex-consumpt . It looks like that warning 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. We plan 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 your app isn't deployment properly then we would need more logs with System.Debug enabled to see what's actually going on and offline we would be happy to investigate if you wanted to share site names and details.

nzthiago avatar Apr 01 '25 17:04 nzthiago

@nzthiago : Yes it is working the app is getting deployed. Was worried with the warning if it is supporting the flex or not. Checked the debug logs it clearly gave details about deployment. Thanks for your help.

amarpandharpure-eaton avatar Apr 04 '25 07:04 amarpandharpure-eaton