I was looking for a way to write a runbook for scheduled, automatic shutdown and deallocation of my Dynamics 365 for Finance and Operations (D365FO/AX8) DEV VM. There are many posts about how to set it up with Azure runbooks. I found that it is much easier than that. Thanks to the free DevTest Labs service there is an easy way for setting it up and it takes just a minute. There is an auto-shutdown function already prepared for this:
It is deallocating too:
No need to work with automation accounts and workbooks. LCS, unfortunately, does not know that the VM is down. It still shows running, but it recognizes after the first try of start or stop.