Azure : Script to start or shut down multiple VMs
Definitively, you should use Azure Automation to run on schedule a PowerShell Script to shutdown or start your VM in Azure. It is already well documented on Microsoft Web site.
Here are 3 links that explains step by step how to do this
Stop Azure Virtual Machine using Azure Automation Runbook https://gallery.technet.microsoft.com/scriptcenter/Stop-Azure-Virtual-Machine-0b1fea97
Shutting down a Azure VM with Azure Automation http://blogs.technet.com/b/georgewallace/archive/2014/11/05/shutting-down-a-azure-vm-with-azure-automation.aspx
Using Azure Automation to run VMs during office hours only https://blogs.endjin.com/2015/01/using-azure-automation-to-run-vms-during-office-hours-only/
Regards
Stanislas
Related videos on Youtube
Sisyphus
Updated on September 18, 2022Comments
-
Sisyphus over 1 year
Is it possible to write and save some kind of script that launches azure powershell, then authenticate azure subscription then start/shutdown multiple VMs in one step?
I have 5 VMs that I use regularly at specific unscheduled time, so I don't want do the steps of logging into azure portal, starting VMs one by one then do the same to shut them down, at every time I need to use them! I need to automate this process.
-
joeqwerty over 8 yearsWhy don't you just leave them running instead of shutting them down?
-
Sisyphus over 8 yearsbecause leaving them running means pay more money :)
-
joeqwerty over 8 yearsMy bad, forgot about per hour pricing.
-
David Makogon over 8 years@joeqwerty Not that it impacts the question, but it's per-minute pricing on VM's....
-