Skip to content

Instantly share code, notes, and snippets.

@JeffBrownTech
Created April 30, 2025 20:57
Show Gist options
  • Save JeffBrownTech/66759e8c45595f9f3e67626dbe0538e5 to your computer and use it in GitHub Desktop.
Save JeffBrownTech/66759e8c45595f9f3e67626dbe0538e5 to your computer and use it in GitHub Desktop.
Azure YAML Pipeline for Deploying Function App
trigger:
branches:
include:
- main
paths:
exclude:
- azure-pipelines*.yml
- README.md
- .gitignore
- .funcignore
- .artifactignore
- .vscode
pool:
vmImage: ubuntu-latest
variables:
functionAppName: 'jbt-funcapp-demo'
azureSubscription: 'Demo'
stages:
- stage: build
displayName: 'Build and Package'
jobs:
- job: Build
displayName: 'Zip Repository and Upload Artifact'
steps:
- task: ArchiveFiles@2
displayName: 'Zip repository'
inputs:
rootFolderOrFile: '$(Build.SourcesDirectory)'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
replaceExistingArchive: true
- task: PublishPipelineArtifact@1
displayName: 'Upload Pipeline Artifact'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
artifact: 'drop'
publishLocation: 'pipeline'
- stage: deploy
displayName: 'Deploy to Azure Function App'
dependsOn: build
condition: succeeded()
jobs:
- job: Deploy
displayName: 'Deploy Function App'
steps:
- checkout: none
- task: DownloadPipelineArtifact@2
displayName: 'Download Pipeline Artifact'
inputs:
buildType: 'current'
artifactName: 'drop'
targetPath: '$(Build.ArtifactStagingDirectory)'
- task: AzureFunctionApp@2
inputs:
connectedServiceNameARM: '$(azureSubscription)'
appType: 'functionAppLinux'
isFlexConsumption: true
appName: '$(functionAppName)'
package: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment