I have a Jenkins Slave configured to start and stop an Azure Ubuntu node. Launch method: Start and stop this node on demand. With a "Start script" and "Stop script" and using "Launch agent agents via SSH".
The VM is started and stop with custom scripts that run az vm start
commands. The scripts work. And Jenkins gets connected and can make a build.
I have "Availibility" set to "Take this agent online when in demand, and offline when idle".
In demand delay: 1
Idle delay: 120
However, after my build is done, the VM gets shutdown by Jenkins shortly after, in the range of a minute or two, not the 120 minutes specified.