- Self hosted agent pool that is connected to a virtual machine scale set
At the moment of writing this blog post the options to keep an Azure DevOps build agent on standby are rather limited. For ex. it is not possible to have a standby agent ONLY during business hours.
There are 2 interesting options: “Number of agents to keep on standby” and “Delay in minutes before deleteing excess idle agents”. Both options do not entirely cover the use case. Increasing the quota of both options are not very cost effective solutions.
As a workaround I’ve configured an Azure DevOps pipeline which will trigger every bussiness hour. This way the agent never gets idle. You can find a YAML example below.
1#This pipeline is used to keep an DevOps agents available only during business hours2trigger: none34schedules:5- cron: 0 7-17 * * 1-5 # At minute 0 past every hour from 7 through 17 on every day-of-week from Monday through Friday.6 displayName: ping-during-business-hours # friendly name given to a specific schedule7 always: true8 branches:9 include:10 - master1112pool: pool-vmss-demo1314steps:15- script: echo Hello, world!16 displayName: 'Run a one-line script'
Make sure that the CRON trigger is lower then the “Delay” setting. In this case the pipeline gets triggered every hour so the delag configuration should > 60 minutes.