There is no separate Azure VM extension for registering agents to Azure Pipelines Environments (virtual machine resources) like the Microsoft.VisualStudio.Services.TeamServicesAgent extension used for classic Deployment Groups.
For YAML Environments with VM resources, registration is done by running the environment’s agent registration script on each machine:
- In Azure DevOps, go to Pipelines > Environments and create a new environment.
- Choose Virtual machines as the resource type and select the OS (Windows or Linux).
- Copy the generated registration script (PowerShell for Windows, shell script for Linux).
- Run this script on each target VM to install and register the agent with the environment.
- The script uses a PAT embedded at generation time (valid for ~3 hours) and is the same for all VMs of that OS in the environment.
- After registration, the VMs appear under the environment’s Resources tab.
If automation is required (similar to how the VM extension worked for Deployment Groups), it must be implemented by invoking these scripts (or the underlying self-hosted agent install/config commands) through custom provisioning logic rather than via a dedicated Azure VM extension.
For classic Deployment Groups, the Azure Pipelines Agent VM extension remains available, but it only targets Deployment Groups, not YAML Environments.
References: