Reading Time: 3 minutes
Share:
Twitter
LinkedIn
Facebook
Reddit
Whatsapp
Follow by Email

Recently whilst looking at the Azure portal I came across a new section on the VM blade that I have not seen before, or I have and forgot about it. This section is called Automation. Under here you have the option to export the arm template for your virtual machine, but you also have this new Tasks section. Of course I clicked it to see what it was about and to my surprise it seems to be a place that has new automation tasks for Azure Virtual Machines that use Azure Logic Apps in the backend. Currently there are only 3 tasks here, Stop VM, Start VM and send monthly cost for resource. Unfortunately, there is no option to create your own, but hopefully that will come. In this article I am going to focus on the Stop and Start tasks. There was an old option using runbooks, but this new option seems to be a lot nicer. You can read about the old way at https://pixelrobots.co.uk/2018/07/start-stop-vms-during-off-hours-solution-in-azure/

Let’s get to it

So, in the Azure portal navigate to the virtual Machine you want to Stop and start. In here on the left-hand side scroll down till you find Automation and then click on Tasks.

Now, in here you will see a list of tasks if you have any created. To create one click on the Add button at the top. In this new blade you will be presented by the available tasks. To start, let’s create a stop task, so go ahead and click Power off a Virtual Machine.

Home > testVM > 
Add a Task 
Select a template 
Authentication 
Select an automation template. 
Configuration 
Send monthly cost for resource 
Sends the cost of the resource every 
month 
Select > 
Power off Virtual Machine 
Stop VM at a scheduled time of the day 
Select > 
Start Virtual Machine 
Start VM at a scheduled time of the day 
Select >

Here you will need to create two Connections. Go ahead and click on Create next to Azure VM

Home > testVM > 
Add a Task 
Select a template 
Authentication Configuration 
Selected template: Power off Virtual Machine 
This task will connect to the fallowing services. Select the connection to add your login credentials. 
Connections 
Name 
Azure VM 
Office 365 Outlook 
Status 
e Nat connected 
e Nat connected 
Next : Configuration > 
Account 
Create 
Create 
Create 
Previous

In here click on the Sign in button and log in. Once done click on the next Create link. Again, sign in. Once done you should have two green ticks, now click Create at the bottom.

Home > testVM > 
Add a Task 
Select a template 
Authentication 
Configuration 
Selected template: Power off Virtual Machine 
This task will connect to the fallowing services. Select the connection to add your login credentials. 
Connections 
Name 
Azure VM 
Office 365 Outlook 
Status 
e Connected 
e Connected 
Next : Configuration > 
Account 
using 
Richard. Hoooeraoixelrobats.co.uk. 
using 
Richard. Hoooeraoixelrobats.co.uk. 
Create 
Previous

It’s now time to enter your schedules information. Just fill in this blade with something that suites you. You can even get a notification when the VM is shut down if you supply your email address. Once filled in click create.

Home > testVM > 
Add a Task 
Validation failed. Required information is missing or not valid. 
Select a template 
Authentication 
Configuration 
Selected template: Power off Virtual Machine 
Task name * 
Stop Time* O 
Timezone* O 
Interval* O 
Frequency* O 
Notify Me O 
Enter email O 
Stop-TestVM 
O This task name cannot be changed after the task has been created 
10/03/2020 
GMT Standard Time 
Day 
riche rd.hooper@pixelrobots.co.uk 
AM 
This task is billable. More information on pricing could be found here. Learn mare 
Create 
Previous

Once it has finished being created you will be back to the Tasks blade and should see something like in the image below.

Home > testVM 
testVM I Tasks 
Virtual machine 
Search (Ctrl+/) 
Availability + scaling 
Configuration 
Identity 
Properties 
Locks 
Operations 
Bastian 
Auto-shutdown 
Backup 
Disaster recovery 
Guest + host updates 
Inventory 
Change tracking 
Configuration management 
Policies 
Run command 
Monitoring 
Insights 
Alerts 
Metrics 
Diagnostic settings 
Logs 
Connection monitor 
Automation 
Tasks 
Export template 
Support + troubleshooting 
Resource health 
Boot diagnostics 
Performance diagnostics (Prev... 
Reset password 
Redeploy 
Serial console 
Connection troubleshoot 
New support request 
Add C_) Refresh 
Name 
Step -TestVM 
Delete 
Type 
@ Scheduled task 
x 
Runs 
View

Now just repeat the above steps but select Start Virtual Machine. You have now created the two tasks to Stop and Start your virtual machine. This new method is a lot better than the old way and hopefully the automation tasks get expanded and perhaps one day a sort of marketplace of tasks will be available.

Thanks for reading. If you have any questions or comments please reach out.

Share:
Twitter
LinkedIn
Facebook
Reddit
Whatsapp
Follow by Email
Categories: AutomationAzure

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.

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *