Auto Start/Stop an Azure VM (ARM)

Auto start stop azure vm (ARM)

For Azure VMs that are not needed to be running 24/7, we can use Azure Automation to schedule auto Start Stop Azure VM. First ensure to reserve resources if needed, such as the Private and the Public IP.

Now lets see how we will Auto Start/Stop an Azure VM (ARM). First create an Automation Account, go to the Azure Portal, expand more services and  search for automation. Then click the “Automation Accounts”

At the Automation Accounts press “Add”

At the Automation Account creation blade provide a Name, the Subscription, the Resource Group, trhe location and if it is the first Automation Account select Yes to create automatically a Run As account

After the creation it will open the new Automation Account’s blade. Here click the “Runbooks”

We don’t need to write any scripting since there are available Runbooks at the gallery, so select Browse gallery

At the Gallery search for the “Start Azure V2 VMs” and “Stop Azure V2 VMs” Graphical Runbooks.

Click the Runbook and a the new blade press Import. Type a unique name and press OK

After the import, we will be navigated to the Runbook and we need to Publish it in order to be able to use it. At the Runbook’s blade, press “Edit”

And then press Publish

After the Publishing the Runbook is ready to Start and add Schedules. Now lets add Schedules to specify the VM and the schedule that will Start. Press “Schedule”

Press Link a schedule to your runbook and then Create a new schedule

Give a name to the schedule, and then select the Start date and time and the recurrency, at my example it will start the VM everyday at 7:00 am

then go to the Parameters and provide the Resourcegroup name and the VM name and press OK.

The Runbook is ready. Create more Schedules for all needed VMs. And then repeat the process for the “Stop Azure VM V2” runbook and you will have two Runbooks with many Schedules. To test a Runbook press “Start”.

 

Share

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.