Need help to power off the assigned vdi VMs when idle or in logged off state for certain time ( e.g 2 weeks).
I am using horizon cloud on azure service to provide dedicated assigned vdi VM to users. To save azure running cost I would like to power off and deallocate vdi VMs that are idle or disconnected for 2 weeks or more.
I have configured power management schedule to keep VMs running 24*7 as I can't determine usage pattern as all users are full time employees. This keeps VM available Everytime and enables users to connect immediately when they connect.
If the power management option is not configured the idle VMs are automatically powered off after few hours and the user has to wait for 10 mins till VMs power on which is annoying.
Could anyone please share ideas or azure automation script to achieve this task?