How to deploy Flex Consumption function from zip file?
There is no documentation at all on how to deploy Flex Consumption from CI. Can you fill that gap???
@pragnagopa, @nzthiago, @alexkarcher-msft Could you, please, comment on this?
We want to deploy them from the Azure DevOps CI pipeline
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>
It works, thank you very much!
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
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
Post you task YAML
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
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.
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 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 : 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.