Build an Azure virtual machine using an Azure RM template
Azure Pipelines | Azure DevOps Server 2019 | TFS 2018 | TFS 2017 | TFS 2015
In Microsoft Team Foundation Server (TFS) 2018 and previous versions, run and release pipelines are called definitions, runs are called builds, service connections are called service endpoints, stages are called environments, and jobs are called phases.
In just a few steps, you can provision Azure virtual machines (VMs) using Resource Manager (RM) templates. Managing the pipelines for virtual machines in this way is considered Infrastructure as code and is a good DevOps practice.
For this example, the template for creating the Azure VMs must be checked into a version control repository along with the rest of the application code, and it must be published as part of the build output.
Create the template
Before you can build the solution, you must create an Azure RM template. Follow these steps to create and check-in a new Resource Manager template.
In Visual Studio, choose File | Add | New project and add a new Azure Resource Group project to your solution.
When prompted for an Azure template, select Windows Virtual Machine.
The Windows Virtual Machine template is a simple example of provisioning a single virtual machine in Azure. For provisioning other types of resources, you can either edit the WindowsVirtualMachine.json file, select other templates in the project creation wizard, or download one of the many templates available at https://github.com/Azure/azure-quickstart-templates.
Add a project for your app to the solution. This could be a project for an existing app, or a new project created from the Visual Studio File | Add | New project menu.
Create the build pipeline
Carry out the following steps to publish an artifact with the Resource Manager template files.
Create a new build pipeline for the solution you just checked into a TFS or Git repo.
Enable continuous integration (CI). This tells the system to queue a build whenever someone on your team commits or checks in new code.
Publish the artifacts from the build. Make sure that the template files from your ARM template project are included in the artifacts published by your build pipeline.
Save the pipeline and queue a new build. Verify that the artifact contains the Templates folder containing the template files WindowsVirtualMachine.json and WindowsVirtualMachine.parameters.json. This is the template that your release pipeline will consume to provision an Azure virtual machine.
Provision your virtual machine
After you've run the build, you're ready to create a release pipeline to provision your virtual machine:
Q & A
I use TFS on-premises and I don't see some of these features. Why not?
Help and support