You can download the Terraform template from here.
This template is very basic in nature. It creates the VM, public IP, Network Interface and Disk. The build agent is installed and configured. Also it installs NodeJS, npm, gulp, zip, powershell & Az module, .Net Core, Jq, Docker engine and compose and other dependencies.
>>You have Agent pool created. The build agent will be added to this Agent pool.
>>Make sure vNet, Subnet and Resource Group are already created and available.
>>Provide the variable default values in variables.tf
Now login to https://dev.azure.com/<your project> and upload the following file to the Repos-
>>Make sure Ubuntu-vstsbuildagent-install.sh is uploaded to blob storage and the path added to VM.tf file.
>> Now go to Pipelines–>Pipelines –> New Pipeline (select classic editor). Select the source, Team Project, Repository and continue
>> Run the build
>>Once build is completed. On Summary tab, you can see the templates are published in drop artifact.
>>Now go to Pipelines–>Releases–>New Pipeline. Select empty job template. Select Add Artifacts and provide the values
>>Create release to provision the VM and build agent. [Note: It will create a VM with Public IP, Disk, Nework Interface. This will be done in existing VNet, Subnet and Resource Group]
>>Once completed you will see the VM and the agent in the pool