How to set the Azure Agent to be disabled while operating system is shutting down?
My case: during pipeline there are some errors that required the the VM to be rebooted. Last task before reboot sends cancellation to the service and the build marked as cancelled.
While the OS is tarting to reboot next pipeline is triggered and is cancelled because of
##[error]Operating system is shutting down for computer '003'
Is there a way I can disable the agent during OS shut down? And to become enabled again after reboot?
System is Windows 10
I have tried to wait until OS is shutting down - did not help.
I have tried to set a Run Once registry to start the agent at next setup but failed
When trying to set the current agent as disabled, I did not mange to finish the current pipeline