Member-only story
Using a YAML Pipeline to Collect DevTest Labs VM Details in Azure DevOps
In modern DevOps practices, YAML-based pipelines have largely replaced the classic pipeline structure in Azure DevOps due to their flexibility, code-based structure, and version control benefits. This article will walk you through how to set up a YAML pipeline that collects the details of a DevTest Labs VM by running an Azure PowerShell script, which is stored in your repository.
Instead of using the classic release pipeline interface to add tasks manually, we will define everything in the YAML pipeline file, making it easier to manage and track changes over time.
Overview
We will cover the following steps:
- Setting up a YAML pipeline that interacts with Azure DevTest Labs.
- Running an Azure PowerShell script to collect the VM details.
- Using pipeline variables to pass the Lab VM ID (
labVmId
) between tasks. - Referencing the PowerShell script stored in the repository.
Step 1: Setting Up the YAML Pipeline
Here’s how you can structure the YAML pipeline to create and manage a DevTest Labs VM and run a PowerShell script to collect the VM details.