Skip to content
Latchkey

How to Deploy a Web App With the AzureWebApp Task in Azure Pipelines

The AzureWebApp@1 task pushes a package or zip to an App Service web app using the service connection you name.

Build and zip your app, then use AzureWebApp@1 with azureSubscription, appName, and package. The task uploads and swaps the package into the running app.

Steps

  • Produce a deployable package or zip in an earlier step.
  • Add AzureWebApp@1 with azureSubscription and appName.
  • Set package to the zip or folder to deploy.

Pipeline

azure-pipelines.yml
steps:
  - script: |
      npm ci && npm run build
      zip -r $(Build.ArtifactStagingDirectory)/app.zip dist
    displayName: Package
  - task: AzureWebApp@1
    inputs:
      azureSubscription: 'prod-arm-connection'
      appName: checkout-api
      package: $(Build.ArtifactStagingDirectory)/app.zip
    displayName: Deploy to App Service

Gotchas

  • Pair this task with a deployment job and environment to record deployment history.
  • Use deployToSlotOrASE and slotName to deploy to a staging slot, then swap.
  • The service connection identity needs Contributor on the target web app.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →