Setting up VM for Auto Start-Stop using Automation Account

Setting up VM for Auto Start-Stop using Automation Account

Using an Azure Automation account to automate your virtual machine schedules can go a long way when it comes to resource optimization and cost savings, especially when you don't need to have your VMs running 24/7.

To set up an automated schedule for your Azure VMs, follow these three steps:

  •          Add the Azure Automation service
  •          Configure runbooks
  •          Schedule runbooks

Add the Azure Automation service

To get started, you can create a resource group. This isn't mandatory, but it's strongly recommended in order to keep things clean and structured.

To add an automation account (on a VM or a resource group), first click Add to add a new service. Then use the search bar to find Automation. The publisher is Microsoft and the category is Developer tools.

Create an Automation account. Specify the settings and click Create to add automation account.

If this is the first automation you're creating, choose Yes for Create Azure Run As account.

Configure runbooks

To configure the runbooks, open the Automation account and click Runbooks in the Process Automation submenu.

Next, select Browse Gallery, located in the top menu.

Use the search bar to find and import the following runbooks:

  • Start Azure V2 VMs (created by: Azure Automation Product Team)
  • Stop Azure V2 VMs (created by: Azure Automation Product Team) Or you may use the Auto Shutdown built-in feature for the VM which you may find after selecting a VM and checking its listings

Name your runbooks, then edit and publish them. Note that newly imported runbooks default to the New state, but in order to be invoked they must be in a Published state.

Schedule the runbooks

Last but not least, it's time to schedule the runbook we just created. To edit the runbook, click Link to schedule.

Create a new schedule and specify the settings to apply. A menu will appear on the right with different settings to define.

Note: The process is the same for automating VM shutdown.

Once your runbook is scheduled, click Start to make it live. Edit the following parameters, then click Ok:

  • Resourcegroupname: Specify the name of the resource group where the VM resides.
  • Vmname: Specify the name of the VM that you would like to start or stop.

There you have it! Your runbooks are ready and will apply your scheduling automation to the selected VMs.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us