How to deploy azure functions app from azure devops correctly

Stefan Szekely 20 Reputation points
2023-12-26T11:43:05.1066667+00:00

Deploying a java functions app from the console works fine with the command:

./mvnw azure-functions:deploy

But while trying to deploy from Azure devops, the functions wont work.
The functions appear on the Functions portal.

The status for every function is "Enabled"
The settings are the same as before.
So everything seems in order, but when I try to evoke a functions. the response is 500 internal server error.

the yaml to buld the artifact

trigger:
- master

pool:
  vmImage: ubuntu-latest

steps:
- task: JavaToolInstaller@0
  displayName: 'JavaToolInstaller Java version 17 '
  inputs:
    versionSpec: '17'
    jdkArchitectureOption: 'x64'
    jdkSourceOption: 'PreInstalled'
- task: Maven@3
  displayName: 'Maven Build and Package'
  inputs:
    mavenPomFile: 'pom.xml'
    goals: 'clean package'
    options: '-DskipTests' # Optional, to skip tests

- task: Maven@3
  displayName: 'Azure Functions Package'
  inputs:
    mavenPomFile: 'pom.xml'
    goals: 'azure-functions:package'
    options: '' 

- task: CopyFiles@2
  displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
  inputs:
    SourceFolder: '$(system.defaultworkingdirectory)'
    Contents: '**/azure-functions/**'     
    TargetFolder: '$(build.artifactstagingdirectory)'
  condition: succeededOrFailed()

- task: ArchiveFiles@2
  displayName: 'Archive $(Build.ArtifactStagingDirectory)/target/azure-functions/f-app-v2'
  inputs:
    rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/target/azure-functions/f-app-v2'
    includeRootFolder: false

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact: drop'
  inputs:
    PathtoPublish: '$(build.artifactstagingdirectory)'
  condition: succeededOrFailed()
Community Center Not monitored
0 comments No comments
{count} votes

Accepted answer
  1. navba-MSFT 27,540 Reputation points Microsoft Employee Moderator
    2023-12-27T03:26:25.3533333+00:00

    @Stefan Szekely Welcome to Microsoft Q&A! Thanks for posting the question.
    .
    Since deploying from the console works fine and the issue occurs only while deploying from Devops, this needs to be troubleshooted from Devops standpoint.
    .
    Please note that, DevOps is currently not supported in the Q&A forums, the supported products are listed over here https://learn.microsoft.com/en-us/answers/products (more to be added later on).
    .
    You can ask the experts in the dedicated forum over here:
    https://stackoverflow.com/questions/tagged/devops https://developercommunity.visualstudio.com/spaces/21/index.html

    Hope this helps.

    **
    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.

    0 comments No comments

0 additional answers

Sort by: Most helpful

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.