Below is a Azure pipeline YML file to deploy a NodeJS function to an Azure NodeJS Linux function.
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
- main
pool:
vmImage: ubuntu-latest
steps:
- task: NodeTool@0
inputs:
versionSpec: '20.x'
displayName: 'Install Node.js'
- task: Bash@3
inputs:
targetType: 'inline'
script: |
# Write your commands here
echo 'Hello world'pwd
# there is a Code folder at the root of my git repo
cd Code
pwd
npm install
- task: ArchiveFiles@2
displayName: 'Archive files'
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)/Code'
includeRootFolder: false
- task: AzureFunctionApp@2
inputs:
connectedServiceNameARM: 'Azure subscription 1 (00000000-0000-0000-0000-000000000000)'
appType: 'functionAppLinux'
appName: 'my-function-name'
package: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
deploymentMethod: 'auto'