As you might know, Azure VMs cost money per hour when they are on. Have you ever wanted to shutdown or startup Azure VMs automatically? You could do it using Azure Automation service in about 28 easy steps by writing a script. Or you could simply use VMPower, a service that I stumbled upon which makes the process much more straight forward and has a few other useful features.
Step 1) Signup for an account at VMPower.io. It doesn’t require a credit card and they have a decent free usage tier.
Step 2) Select ‘Microsoft Azure’ and Link your Azure Subscription:
The only tricky part is knowing your Azure Active Directory domain name. If you use a regular (non-work/school) domain your domain could be something like:
Sometimes it is listed on the top right of the Azure portal:
Step 3) You will be sent to the Azure login page. After you sign in, you’ll be re-directed back to your cloud subscriptions page on VMPower:
It will automatically add all of your Azure subscriptions.
Step 4) Now go to the virtual machines section and click on the VMs you want to create what VMPower calls a ‘VM Group‘. Basically this is a logical grouping of VMs to apply rules to in batches:
Step 5) Click ‘Add to VM Group’. Give the group a name and click Create
Step 6) In the VMGroups section click on the ‘Edit or Create Schedule‘ button
Step 7) You’ll get a dialog that looks almost like a weekly meeting planner. Here you can create times you want your VM to be on or off on the calendar. Select ‘Turn these VMs on’ for your VMs to be on during the blue zones and off during the gray zones. Selecting turn these VMs off will reverse it and make the gray zone times with your VMs on and the blue zones with your VMs off.
Note: Be sure to check your appropriate timezone. Check the ‘Enabled’ flag to ‘on’ otherwise your VMs will never stop/start.
You’ll get email notifications from the service (they support slack messages, too) whenever something is about to happen to your VMs. You can turn this off since after a while it might fill up your mailbox, or just forward it to a distribution list.
- Instead of strictly shutting off your VM by time, you can shut it down once cpu/disk/network utilization falls below certain thresholds.
- You can get alerts about low utilization VMs.
- VMPower recommends ‘better’ sizes for your VMs based on load (and tells you the cost savings, to boot!)
So to be honest not a bad service considering the other options of using Azure automation service. You could also possibly use Azure dev/test labs to schedule VMs but the scheduling feature doesn’t seem as intricate as VMPower and you won’t get utilization-based shutdowns either.
Looks like you’ll have to pay a small fee to use VMs over $200/month but depending on your VMs/savings it may make sense. I also emailed VMPower (email@example.com) and got a free two week upgrade for my larger VMs.