VM automatic shutdown after some idle time.
Sometimes VM's are forgotten up and they are running idle. There should be possibility to define in Auto shutdown settings that "if these VM's are idle for x hours then shut down them."
Thanks for your idea! This idea is currently in our backlog and being prioritized this with other features. If you have any criteria in mind how you would like to define “idle” state, please share with us.
Steve Catmull commented
I could see this being really useful in situations where we often leave dev/test environments open for extended hours (e.g, 5pm-9pm). If it has not been active for x hours before scheduled off time, shut it down early when the idle criteria is met.
As far as what constitutes idle criteria, let's light up some machine learning. Imagine if we could train it through machine-learning to identify idleness. I think it will be hard to define quantitatively but if you could start to use some of the great work in Application Insights Smart Detection that would be great.
Give us some time periods that look like idle based on performance counters / users logins, etc. Then we will help you identify false positive and false negatives. My guess would be that many machines will have unique patterns and maybe we need to opt in for idle detection. Then train on those that opt in.
Windows itself has the feature we need in the bog standard OS power management, but for whatever reason the capability isn't even presented as an option in Windows Server 2016 as deployed from the marketplace image in Azure. None of the power management options in deployed VMs even gives the "power off after X minutes" option, like every single laptop OS image has.
Giving us that option would let us configure the OS itself to decide when to shutdown based on user activity, and the OS is in the best position to decide that. Then we can script something or even have other admins manually check in the Azure Portal that a VM is "not running but still incurring charges", and then we can "stop/deprovision".
And it's probably not a long step to request an "if OS shuts down and system stays down, deprovision" feature in Azure. I bet that feature request already exists :)
I propose 2 Idle indicators:
- no user logged/interaction - for X amount of time
- CPU consumption below Y % for X amount of time
Nguyen Ngoc Tin commented
For us, if there is no interaction from user (mouse action, key press...) for 30 min then the VM should consider the developer is away and shutdown it self.
Add schedule turn on time too its useful for dev environment
Peeush Bajpai commented
For us, idle is when either there's no active user login session or when the logged in user(s) have not "used" (read: have been completely idle) the machine for some time.
Stephan Human commented
We manage this for 500 VMs, used in demo / test cases, and we need a standard way to enforce this, not just in devtest labs, but elsewhere as well.
Stephan Human commented
We are doing this today using a GPO on all our demo and training machines. It basically uses the logoff at idle policy. We then have another scheduled task that runs every 10 min, that runs and checks if there are any sessions open. If it finds zero, it will issue a shutdown with deallocate. We actually call out to an external service to do this for us. If it is not shutdown, the machine kicks in its own shutdown, but then it is not deallocated. On an hourly basis, we run another script to find any machine that is stopped, but not deallocated, and then force to to deallocated.
Karl Fasick commented
It has been helpful to me to set a CPU % less than about 5% over 15 minutes alert. Multiple people use the VM, so Yes, it's hard to nail down definition of idle, but if it gets left for too long with too many cores it starts emailing me.