Azure/custom-script-extension-linux

VMSS - stop VM deployment, mark it as bad, if custom script extension fails

stefanmd023 opened this issue · 1 comments

I am creating a linux VMSS to be used as Azure Virtual Machine Scale Set agents

I am using a custom linux script extension that installs some stuff on deployment.

These installs are important, so much so that if they fail, I want in some way to thow an error and stop the VM from being deployed to the VMSS.

Is there some way the script can signal this back to the VMSS to mark the instance as failed such that the VMSS will delete the instance and redeploy a new instance?

Putting this here in case anyone needs it, CustomScript respects bash's exit status command, with exit 0 being a success and anything else (exit 1+) being a failure.

This gets reflected as an error and provisioning failed on the customscript, which does not qualify it to be an ADO agent, and a new one is deployed eventually (though there is a long timeout)