Deploy web apps to an IIS server on a Windows VM
Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019
Learn how to use a Classic pipeline to deploy an ASP.NET Core or Node.js web app to an IIS web server virtual machine (VM) in a Windows deployment group.
Prerequisites
- An Azure DevOps organization and project. To create an organization and project, see Create a new organization or Create a project in Azure DevOps.
- A Classic pipeline to build your project. For instructions, see Build .NET Core apps.
- A configured IIS web server. For instructions, see Host ASP.NET Core on Windows with IIS.
Create a deployment group
A deployment group is a logical set of target machines that each have an Azure Pipelines deployment agent installed. Deployment groups make it easier to organize the servers that you want to use to host your app. Each machine interacts with Azure Pipelines to coordinate the deployment of your app.
To create the deployment group:
From your Azure DevOps project, select Pipelines > Deployment groups from the left menu.
On the Deployment groups screen, select New, or select Add a deployment group if this deployment group is the first one in the project.
Enter a Deployment group name and optional Description, and then select Create.
On the next screen, in the machine registration section, select Windows for the Type of target to register. A registration script is generated.
Select Use a personal access token in the script for authentication. For more information, see Use personal access tokens.
Select Copy script to the clipboard.
On each of your target VMs:
Use an account with administrative permissions to sign in to the VM.
To register the machine and install the agent, open an Administrator PowerShell command prompt and run the script you copied.
When you're prompted to configure optional tags for the agent, press Enter to skip. 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. For more information, see Security groups, service accounts, and permissions.
After you set up a target server, the script should return the message Service vstsagent.{computer-name} started successfully
.
On the Targets tab of the Azure Pipelines Deployment groups page, you can verify that the VMs are listed and the agents are running. Refresh the page if necessary.
Create a release pipeline
Deploy the artifacts from your build pipeline to your IIS server by using a release pipeline.
From your Azure DevOps project, select Pipelines > Releases, and then select New > New release pipeline.
On the Select a template screen, search for and select IIS website deployment, and then select Apply.
In your release pipeline, select Add an artifact.
On the Add an artifact screen, select Build, select your Project and your Source (build pipeline), and then select Add.
On the release pipeline screen, select the Continuous deployment trigger icon in the Artifacts section.
On the Continuous deployment screen, enable the Continuous deployment trigger,
Under Build branch filters, add the main build branch as a filter.
On the release pipeline screen, select Tasks, and then select IIS Deployment.
On the settings screen, under Deployment group, select the deployment group you created earlier.
Select Save.
Deploy your app
- From Pipelines > Releases, select the release pipeline you just created, and then select Create release.
- Check that the artifact version you want to use is selected, and then select Create.
- Select the release name link in the information bar message Release <release name link> has been queued.
- Select View logs to see the logs and agent output.