Forum Discussion
Automated way to Stop and Start Scaling Scripts
We have scaling scripts that run for an AVD pool that takes the 15 VM pool down to 2 running VMs during off-peak hours. This scaling script runs every 15 minutes and will shut down anymore than 2 running VMs if not in use.
We also have Azure Update Management setup for installing security updates / patches on the VMs in the Pool. This starts the VMs on Saturday nights at 11 PM and goes through the update process.
An issue we are experiencing is that the scaling script is shutting down VMs in the pool before Windows Updates can be run and installed on the VMs. The VMs boot up at 11 PM, but most end up getting shut down within 15-30 minutes by scaling script and never even start the Windows Updates process. If you look in the logs for Update Management on the VMs, there is nothing listed as they shut down before they could start the process. The only VMs that run the process are the ones the script doesnt auto shutdown.
What can I do to allow these VMs to be started at 11 PM on Saturday nights and run through Windows Updates before they are shut down again by scaling?
Thank you
- ATWVDCopper Contributor
We use automation runbooks for this, one runbook for disable and one for enable. Use a schedule to run disable on the day before patching and then run the runbook for enable the day after.
Set-AzLogicApp -ResourceGroupName "your logic app resource group" -Name "logic app name" -State "Enabled" -Force - JasonMastenMicrosoftI like the solution ATWVD provided. You can also use the Maintenance tag built-in to the AVD Scaling Automation solution. Use a runbook to tag the VM's and turn them on. After patching, remove the tag.