Forum Discussion
Scaling Plan with AVD session hosts on Azure Local doesn't perform a clean shutdown
I have setup a scaling plan for my AVD sessions hosts that are running on Azure Local. The scaling plan is working as expected and the machines are taken offline during the hours specified which is reducing the service fee costs.
However, I've noticed that the Scaling Plan is simply powering off the VM, it's not telling the VM to cleanly shut down which is leading to the sessions hosts having event log entries that they weren't shut down correctly and putting them at risk of disk corruption issues. Is this intended?
1 Reply
Try this as workaround:
1. Custom Automation for Clean Shutdown
Use Azure Automation or PowerShell scripts to:
• Gracefully log off users
• Stop services
• Trigger a clean shutdown before deallocationStop-Computer -ComputerName "SessionHost01" -Force
You can schedule this to run just before the scaling plan kicks in.
2. Use Logoff + Delay Strategy
• Configure session hosts to log off disconnected users automatically
• Add a buffer time between user logoff and VM deallocation
• This gives the OS time to settle before shutdown
3. Monitor with Event Logs
Track shutdown events using:
• Event ID 6008 (unexpected shutdown)
• Event ID 1074 (planned shutdown)
This helps validate whether your workaround is working.