DEV Community

sherifsameh
sherifsameh

Posted on

Manage your Azure resources using automation tasks

An Automation Task is actually a workflow that runs on the Azure Logic Apps service behind the scenes. Automation tasks are currently in preview and support sending monthly cost for all Azure resources and special templates for Azure virtual machines, Azure Storage accounts, and Azure Cosmos DB.

Azure offers a simple way to manage a specific resource or resource group using automation task templates. These templates depend on the Azure resource. For example, for an Azure virtual machine, you can create an automation task that turns on or turns off that virtual machine on a predefined schedule or sends the resource's monthly cost. This can be especially helpful if you are trying to reduce the cost of your Azure VMs.

You might now think how this is different from Azure Automation. For that, you can check out the following article on Microsoft Docs.

How to create an automation task
Creating an automation task is simple. In the Azure Portal, find the resource you want to manage, and on the resource menu, scroll to the Automation section and select Tasks.


Now you will see the existing automation tasks, or you can click on Add to add a new automation task from a template.

You can select the template you want to use. Under Authentication, the necessary connections for that specific task appear. You will need to create these connections.

In the configuration section, you can add additional information for the task. In this example, I start the virtual machine every day at 10 am.

After the automation task has been created, you can see it under Tasks. You can see the tasks and view the runs, as well as edit the task.

You can do in-line editing to make simple changes, but you can also open it in the Logic Apps Designer.

Manage Azure Resources using Automation tasks — new way

To help you manage Azure resources more easily, we can create automated management tasks for a specific resource or resource group by using automation task templates. Today you can schedule a shutdown time for an Azure VM. You’ll find this under your VM’s >> Operations >> Auto-shutdown section

We can also use Azure Automation runbooks to schedule VM startup/shutdown at scale startup/shutdown.

Azure now provides a new way to schedule start/stop Azure VMs. For an Azure virtual machine
you can create an automation task that starts/stops an Azure virtual machine on a predefined schedule. Behind the scenes, an automation task is actually a workflow that runs on the
Azure Logic Apps serviceand is billed using the same pricing ratesand pricing model

Important: This capability is in public preview, is provided without a service level agreement, and is not recommended for production workloads. Certain features might not be supported or might have constrained capabilities.

Prerequisites

An Azure account and subscription. If you don’t have a subscription, sign up for a free Azure account.
The Azure resource that you want to manage. This article uses an Azure Virtual Machine as the example.
An Office 365 account if you want to follow along with the example, which sends you email by using Office 365 Outlook.

Create Automation Tasks

Login to the Azure Portal: https://portal.azure.com
Go to your VM >> Automation >> Tasks


Click on +Add and add 2 tasks: one for Start and the other task to Power off the Virtual Machine.


You can repeat the same process to Power off the VMs. You’ll see 2 Logic Apps and the corresponding API connections in your resource group or Logic Apps view


That’s it. Your VMs will start/stop at the scheduled times. Now a question arises. How are Automation tasks differ from the Azure Automation?

Automation tasks are more basic and lightweight than Azure Automation and can only be created at the resource level. By comparison, Azure Automation is a cloud-based automation and configuration service that supports consistent management across your Azure and non-Azure environments. The service comprisesprocess automation for orchestrating processes by using runbooks,configuration management with change tracking and inventory,update management, shared capabilities, and heterogeneous features. Automation gives you complete control (at scale) during deployment, operations, and decommissioning of workloads and resources.

Automation Tasks is currently in preview and provides an easy and simple way to manage Azure resources

Top comments (0)