Search code examples
azureazure-devopsazure-pipelinesazure-vm

How to host a VM image in Azure pipeline to run the tasks instead of using self hosted agent?


I have a requirement where I need to host the VM image in Azure pipeline and run the testing with the tools added in the VM image and delete the VM. The main aim is to avoid the cost of permanent VM(Self agent) and create a VM at run time and use it. Currently, I have taken snapshot of a VM image. But, I did not have enough references to host that VM image in the azure pipeline run time.

In this page https://learn.microsoft.com/en-us/training/modules/host-build-agent/2-choose-a-build-agent, it explains three types of self hosting. Refer the How do you set up a private build agent? topic. I need help in using the third type of self hosted deployment.


Solution

  • According to your description, we suppose that you could use VMSS as workaround.

    1.Create VMSS at Azure Portal enter image description here

    2.configure vmss agent pool at devops enter image description here

    3.for special start-up configuration, you could add custom extensions enter image description here