Sequentially Start & Stop Azure VMs

You can see the Azure automation version of sequentially starting & stopping Azure VMs on my other post.

Have you ever wanted to sequentially start and stop your Azure Virtual Machines all in one hit? Not just Azure VMs, you can use this same method for any sequential job you want to run in Azure.

The following script will start and stop your Azure VMs in parallel by using background jobs in PowerShell. Please note, this script is based on Azure Resource Manager, however with easy change to the code, this same structure will still work with Azure Service Management.

Also note that this script won’t work if you’re logging onto Azure with a Microsoft account. In this instance, you would need to go into the Azure AD directory and create a user in the Azure AD organisation directory in which is linked to your Azure subscription. Make this user a (co-administrator or contributor) of Azure and use this account with the below PowerShell script.