2

I created a Scale Set within Azure from a specialized Windows 10 image with some custom software stack installed.

When I try to run pipeline jobs on this, all seem to work fine until suddenly the agent gets killed as unhealthy by Azure Devops. While I tried several things out, I observed, that this arbitrary kills are somehow correlated to running a second job on the scale set. My guess is, that Azure Devops can't handle multiple agents with the same computer name, which is - by default - the case when I create a ScaleSet from a specialized Azure VM image.

Is there any workaround or does Azure Devops only supports ScaleSets from generalized VMs? I actually tried to change the hostname with a custom script extension to the VMSS, but I didn't get it to work.

seflue
  • 41
  • 3

1 Answers1

0

As @JohnHanley mentioned, you will need to run the sysprep command before imaging the VM. You can use the non-generalized image, but as you noted, it also contains the machine name and doesn't apply the prefix.

As the last step before you stop the VM and image it, run this in PowerShell

$sysprepPath = $env:windir + "\system32\sysprep\sysprep.exe"
Start-Process -FilePath $sysprepPath -ArgumentList "/generalize /oobe /quit /quiet" -Verb RunAs -Wait  
joelforsyth
  • 836
  • 1
  • 11
  • 28
  • This is basically, what Microsoft is referring to with "generalizing" the VM, isn't it? Or in which way is it different from generalizing a VM? – seflue Feb 28 '22 at 06:26
  • @seflue yes, this is generalizing the VM. The scale set needs a generalized VM to create new, separate instances of it. – joelforsyth Mar 03 '22 at 13:59