0
votes

I'm trying to configure my pipeline to deploy a java function from Azure devops. Below are screenshots of my release configuration as well as a copy of the deployment logs. The release runs successfully but it does not create/deploy a function under my function app. Any reference material to help me understand how this deployment process works would be greatly appreciated.

Note: I'm able to deploy the app directly from Visual Studio Code using the "Deploy to Function App" option.

enter image description here

Deployment logs

2018-11-01T01:23:27.8081386Z ##[section]Starting: Deploy Azure App Service
2018-11-01T01:23:27.8089617Z ==============================================================================
2018-11-01T01:23:27.8089706Z Task         : Azure App Service Deploy
2018-11-01T01:23:27.8089797Z Description  : Update Azure App Services on Windows, Web App on Linux with built-in images or Docker containers, ASP.NET, .NET Core, PHP, Python or Node.js based Web applications, Function Apps on Windows or Linux with Docker Containers, Mobile Apps, API applications, Web Jobs using Web Deploy / Kudu REST APIs
2018-11-01T01:23:27.8089913Z Version      : 4.3.9
2018-11-01T01:23:27.8089958Z Author       : Microsoft Corporation
2018-11-01T01:23:27.8090030Z Help         : [More information](https://aka.ms/azurermwebdeployreadme)
2018-11-01T01:23:27.8090094Z ==============================================================================
2018-11-01T01:23:29.0637937Z Got service connection details for Azure App Service:'app-name'
2018-11-01T01:23:30.3390907Z App Service Application URL: http://app-name.azurewebsites.net
2018-11-01T01:23:30.3396999Z Successfully generated web.config file
2018-11-01T01:23:30.3851617Z Updating App Service Application settings. Data: {"WEBSITE_RUN_FROM_PACKAGE":"0"}
2018-11-01T01:23:30.7694820Z Updated App Service Application settings and Kudu Application settings.
2018-11-01T01:23:31.6821221Z Package deployment using ZIP Deploy initiated.
2018-11-01T01:23:55.3835039Z Deploy logs can be viewed at https://app-name.scm.azurewebsites.net/api/deployments/00a9ea2e2c634b1f81355f26b7c0f52b/log
2018-11-01T01:23:55.3835345Z Successfully deployed web package to App Service.
2018-11-01T01:23:57.2965141Z Successfully added release annotation to the Application Insight : app-name
2018-11-01T01:23:58.4077123Z Successfully updated deployment History at https://app-name.scm.azurewebsites.net/api/deployments/12345667890
2018-11-01T01:23:59.0842425Z ##[section]Finishing: Deploy Azure App Service
2

2 Answers

2
votes

To enable your Azure Functions to be part of the deployment within Azure DevOps Pipelines release (CD), you need to set up and configure your Azure Functions app using Azure portal.

There are some steps have to be done in the configuration of your Azure Functions, and these steps are common regardless whatever languages you use to develop Azure Functions.

These are the tasks:

  1. Ensure that your function apps have met certain folder hierarchies
  2. Set up Continuous Deployment of your functions app using Azure portal, and ensure that you are using source from your Azure DevOps repo.
  3. Configure deployment options, including the deployment environment
  4. Configure the deployment credentials. Use the credentials to enable Azure DevOps to connect to your function app deployment

For more information in detail about those steps, please visit this MSFT docs on enabling continuous deployment on Azure Functions:

https://docs.microsoft.com/en-us/azure/azure-functions/functions-continuous-deployment

1
votes

See you publish *.jar file to Function app, actually function app content is more than a jar file. Locally check folder functionappname/target/azure-functions/functionappname, after mvn build on Azure DevOps, same artifacts there are supposed to be published.

Here's an exhaustive tutorial of deploying java function in Azure DevOps.

To conclude, several steps in build and release pipeline.

  1. Choose Maven task, nothing special.
  2. Copy File task, set Content to **/azure-functions/** as mentioned above.
  3. Add Archive task, set Root folder or file to archive to $(build.artifactstagingdirectory)/target/azure-functions/<yourfunctionappname>, we can add variable for functionappname as suggested. And remember to uncheck Prepend root folder name to archive path.
  4. Publish Artifact, set Path to publish to $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip.
  5. Tutorial adds release step directly in build pipeline for simplicity, to work with release pipeline, adding one default Azure app service deploy task is enough, nothing to set except basic info like app name and so on. In 4.* Preview task, the default deployment method is Run from package, we can choose other method like the tutorial says.