Deploy a web app to Azure App Services

Azure Pipelines | TFS 2018 | TFS 2017.2

We'll show you how to set up continuous deployment of your ASP.NET or Node.js app to an Azure Web App using Azure Pipelines or Team Foundation Server (TFS). You can use the steps in this quickstart as long as your continuous integration pipeline publishes a Web Deploy package.

Prerequisites

Before you begin, you'll need a CI build that publishes your Web Deploy package. To set up CI for your specific type of app, see:

You'll also need an Azure Web App where you will deploy the app.

Define your CD release pipeline

Your CD release pipeline picks up the artifacts published by your CI build and then deploys them to your Azure web site.

  1. Do one of the following to start creating a release pipeline:

    • If you've just completed a CI build (see above), choose the link (for example, Build 20170815.1) to open the build summary. Then choose Release to start a new release pipeline that's automatically linked to the build pipeline.

    • Open the Releases tab in Azure Pipelines, open the + drop-down in the list of release pipelines, and choose Create release pipeline.

  2. The easiest way to create a release pipeline is to use a template. If you are deploying a Node.js app, select the Deploy Node.js App to Azure App Service template. Otherwise, select the Azure App Service Deployment template. Then choose Apply.

    The only difference between these templates is that Node.js template configures the task to generate a web.config file containing a parameter that starts the iisnode service.

  3. If you created your new release pipeline from a build summary, check that the build pipeline and artifact is shown in the Artifacts section on the Pipeline tab. If you created a new release pipeline from the Releases tab, choose the + Add link and select your build artifact.

  4. Choose the Continuous deployment icon in the Artifacts section, check that the continuous deployment trigger is enabled, and add a filter to include the master branch.

    Continuous deployment is not enabled by default when you create a new release pipeline from the Releases tab.

  5. Open the Tasks tab and, with Stage 1 selected, configure the task property variables as follows:

    • Azure Subscription: Select a connection from the list under Available Azure Service Connections or create a more restricted permissions connection to your Azure subscription. If you are using Azure Pipelines and if you see an Authorize button next to the input, click on it to authorize Azure Pipelines to connect to your Azure subscription. If you are using TFS or if you do not see the desired Azure subscription in the list of subscriptions, see Azure Resource Manager service connection to manually set up the connection.

    • App Service Name: Select the name of the web app from your subscription.

    NOTE: Some settings for the tasks may have been automatically defined as stage variables when you created a release pipeline from a template. These settings cannot be modified in the task settings; instead you must select the parent stage item in order to edit these settings.

  6. Save the release pipeline.

Create a release to deploy your app

You're now ready to create a release, which means to run the release pipeline with the artifacts produced by a specific build. This will result in deploying the build:

  1. Choose + Release and select Create a release.

  2. In the Create a new release panel, check that the artifact version you want to use is selected and choose Create.

  3. Choose the release link in the information bar message. For example: "Release Release-1 has been created".

  4. In the pipeline view, choose the status link in the stages of the pipeline to see the logs and agent output.

  5. After the release is complete, navigate to your site running in Azure using the Web App URL http://{web_app_name}.azurewebsites.net, and verify its contents.

Next step