Reading Time: 4 minutes
Share:
Twitter
LinkedIn
Facebook
Google+
Reddit
Whatsapp
Follow by Email

I have some Virtual Machines running in Azure that do not need to be on all the time. In fact, they are just training machines. I needed a way to stop and start the VMs out of business hours without having to do it manually. After some research I came across a Microsoft solution called Start/Stop. This solution basically creates an Automation task to stop and then start your VMs on a schedule. Below you will find a step by step guide on how to set this up.

Setup the Solution

In the Azure portal click the green + and search for Start/Stop

Click on Start/Stop VMs during off-hours. Then click Create

Next, click on Workspace to either create a new OMS Workspace or use an existing.

Now click on Automation account to either create a new one or use an existing. I don’t have any so I will create a new one.

Once you have created or selected your Automation account click on Configure parameters

In here you need to fill in Target ResourceGroup Names (strin0, VM Exclude List (string),Schedule and Email notifications. Then click OK

Target ResourceGroup Names – These are resource group names that contain VMs to be managed by this solution. You can enter more than one name and separate each by using a comma (values are not case-sensitive). Using a wildcard is supported if you want to target VMs in all resource groups in the subscription. This value is stored in the External_Start_ResourceGroupNames and External_Stop_ResourceGroupNames variables.

VM Exclude List (string) – This is the name of one or more virtual machines from the target resource group. You can enter more than one name and separate each by using a comma (values are not case-sensitive). Using a wildcard is supported. This value is stored in the External_ExcludeVMNames variable.

Schedule – This is a recurring date and time for starting and stopping the VMs in the target resource groups. By default, the schedule is configured for 30 minutes from now. Selecting a different region is not available. To configure the schedule to your specific time zone after configuring the solution, see Modifying the startup and shutdown schedule.

Email notifications – Accept the default value of Yes and provide a valid email address. If you select No but decide at a later date that you want to receive email notifications, you can update the action group that is created with valid email addresses separated by a comma.

Note: By default the Target ResourceGroup Names is set to a *. This will target all VMs in your subscription. So make sure to change it!

Now click Create

If you have enabled email alerts you should receive an email like the one below.

The deployment of this solution will take some time. You can check on the progress using the Bell icon in the top right of the Azure Portal.

Once the deployment has finished you can sit back and let your VMs stop and start with your schedule.

Check the solution

If you would like to view your new Start/Stop solution. Click on All services and then search for Solutions

You should then be able to locate the solution. It will start with Start-Stop-VM and it will look like the image below.

Configure Email Notifications

If you would like to change the email address or add another you will need to change the action group that was created during the deployment.

In the Azure Portal navigate to Monitor and then click Action Groups

Locate and click on the StartSTop_VM_notification group and click Edit details

Here you can edit the email address, or even add alternative methods of contact, like SMS etc.

If you would like to have multiple email address you will need to add extra actions or use a distribution email address like I have.

I hope you found this article helpful. If you have any questions please reach out in the normal methods.

Share:
Twitter
LinkedIn
Facebook
Google+
Reddit
Whatsapp
Follow by Email

Pixel Robots.

I’m Richard Hooper aka Pixel Robots. I started this blog in 2016 for a couple reasons. The first reason was basically just a place for me to store my step by step guides, troubleshooting guides and just plain ideas about being a sysadmin. The second reason was to share what I have learned and found out with other people like me. Hopefully, you can find something useful on the site.

1 Comment

Ramsy · December 20, 2018 at 8:56 pm

How can you adjust / edit the time schedule?

Leave a Reply

Your e-mail address will not be published. Required fields are marked *

*

I agree