Partajați prin


Deploy apps to a Windows Virtual Machine

TFS 2018

Learn how to use Azure Pipelines to build and deploy your ASP.NET, ASP.NET Core, or Node.js web app to an IIS web server running on a Windows Virtual Machine.

Prerequisites

Build Pipeline

Set up a build pipeline if you don't have one already.

Configure IIS web server

Configure your IIS server if you haven't done so already

In an elevated PowerShell command prompt window, run the following command to install IIS:

Install-WindowsFeature Web-Server,Web-Asp-Net45,NET-Framework-Features

Create a deployment group

Deployment groups make it easier to organize the servers that you want to use to host your app. A deployment group is a collection of machines with an Azure Pipelines agent on each of them. Each machine interacts with Azure Pipelines to coordinate the deployment of your app.

  1. Select Pipelines, and then select Deployment groups.

  2. Select Add a deployment group (or New if there are already deployment groups in place).

  3. Enter a name for your group, and then select Create.

  4. In the machine registration section, make sure that Windows is selected from the dropdown menu, and that the Use a personal access token in the script for authentication checkbox is also selected. Select Copy script to clipboard when you are done. The script that you've copied to your clipboard will download and configure an agent on the VM so that it can receive new web deployment packages and apply them to IIS.

  5. Log in to your VM, open an elevated PowerShell command prompt window and run the script.

  6. When you're prompted to configure tags for the agent, press Enter to skip. (tags are optional)

  7. When you're prompted for the user account, press Enter to accept the defaults.

    Note

    The agent running the pipeline must have access to the *C:\Windows\system32\inetsrv* directory. See Security groups, service accounts, and permissions for more details.

  8. You should see the following message when the script is done Service vstsagent.account.computername started successfully.

  9. Navigate to Deployment groups, and then select your deployment group. Select the Targets tab and make sure your VM is listed.

Create a release pipeline

Using release pipelines, you can deploy your build artifacts to your IIS servers.

  1. Select Pipelines, and then select Releases. Select New pipeline.

  2. Use the search bar to find the IIS Website Deployment template, and then select Apply.

    A screenshot showing how to add the IIS website deployment template.

  3. Select Add an artifact to add your build artifact.

  4. Select Build, and then select your Project and your Source (build pipeline). Select Add when you are done.

  5. Select the Continuous deployment trigger icon in the Artifacts section. Enable the Continuous deployment trigger, and add the main branch as a filter.

  6. Select Tasks, and then select IIS Deployment. Select the deployment group you created earlier from the dropdown menu.

    A screenshot showing how to set up the IIS deployment group.

  7. Select Save when you are done.

Deploy your app

  1. Select Pipelines > Releases, and then select Create release.

  2. Check that the artifact version you want to use is selected and then select Create.

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

  4. Navigate to your pipeline Logs to see the logs and agent output.