Deploying a .NET Core 2.1 Azure linux function

Published on 10 December 2019

Here's a very basic yaml pipeline that deploys a C# .NET Core 2.1 function created with Visual Studio Code via Azure DevOps.

pool:
  vmImage: 'ubuntu-latest'

steps:

- task: DotNetCoreCLI@2
  inputs:
    command: 'build'
    projects: '**/*.csproj'
    arguments: '--output $(Build.ArtifactStagingDirectory) --configuration Release'

- task: ArchiveFiles@2
  inputs:
    rootFolderOrFile: '$(Build.ArtifactStagingDirectory)'
    includeRootFolder: false
    archiveType: 'zip'
    archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
    replaceExistingArchive: true

- task: AzureFunctionApp@1
  inputs:
    azureSubscription: 'Pay-As-You-Go(2xxx6edf-xxxx-xxxx-xxxx-e1xxx5dfb73)'
    appType: 'functionAppLinux'
    appName: 'hoetzfunc'
    package: '$(Build.ArtifactStagingDirectory)/**/*.zip'
    runtimeStack: 'DOCKER|microsoft/azure-functions-dotnet-core2.0:2.0'