MS Azure: VM auto start/shutdown

user9118621 picture user9118621 · Dec 19, 2017 · Viewed 14.4k times · Source

Is there any way in which I can automate stopping my VM on a Friday and starting this back up again on the Sunday evening at specified times?

I’m aware this is possible via the VM blade and DevTest labs but their only option is daily, whereas I want this only shut down in the weekends.

Any input will be greatly appreciated. Thanks

Answer

Dean Goodman picture Dean Goodman · Dec 19, 2017

Given that you need more precise control over scheduling than is possible in the Azure VM Auto-Shutdown blade or Azure Dev-Test Labs, you can accomplish startup / shutdown on specific days via RunBooks in an Azure Automation Resource.

  1. Create (or choose an existing) Azure Automation Account resource
  2. In the new Automation resource, go to the Runbooks blade
  3. Click "Browse Gallery"
  4. Search for and import "Stop Azure V2 VMs" and "Start Azure V2 VMs" runbooks
  5. Schedule the new runbooks to run as needed

This walkthrough shows how to setup your runbooks with a specific schedule and parameters to target your virtual machine(s).