Manage your Azure resources using automation tasks
Tags: azure, microsoft, arm
Published: 2023-12-11 10:39:17

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](https://learn.microsoft.com/en-us/azure/automation/overview?WT.mc_id=modinfra-12276-thmaure). For that, you can check out the following article on [Microsoft Docs](https://learn.microsoft.com/en-us/azure/logic-apps/create-automation-tasks-azure-resources?WT.mc_id=modinfra-12276-thmaure#how-do-automation-tasks-differ-from-azure-automation).

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**.

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6n6s85d9rzkm73wt4zsy.png)
Now you will see the existing automation tasks, or you can click on Add to add a new **automation task** from a **template**.

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v8gnaqhhbiumzygvfj60.png)

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.

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2p8glt8frapra1urkph3.png)

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.

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kdzhy6o1t5kty0jbw20v.png)

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.

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xyf4m3omcx9n7fhs801b.png)

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

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m792far45b5ges2yn117.png)
# **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
![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p5iz33vz5zl7lou0643n.png)

We can also use Azure Automation runbooks to schedule VM startup/shutdown at scale [startup/shutdown](https://learn.microsoft.com/en-us/azure/automation/automation-solution-vm-management).

Azure now provides a new way to schedule start/stop Azure VMs. For an  [Azure virtual machine](https://azure.microsoft.com/en-us/products/virtual-machines/)
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 service](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-overview)and is billed using the same [pricing rates](https://azure.microsoft.com/en-us/pricing/details/logic-apps/)and [pricing model](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-pricing)

>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**

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6n6tgdko0ri31jeweoz3.png)
Click on +Add and add 2 tasks: one for Start and the other task to Power off the Virtual Machine.

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4k5833ogzg1t3kpgd8cg.png)

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ktzonfen271ze4t7sgdb.png)

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b8rjzrmm03ar91i7o37j.png)
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


![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z1jadn14662btfgx7nze.png)
![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i6vapqkzuvt5nwp1zcpe.png)

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](https://learn.microsoft.com/en-us/azure/automation/overview) 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 comprises[process automation for orchestrating processes](https://learn.microsoft.com/en-us/azure/automation/overview#process-automation) by using [runbooks](https://learn.microsoft.com/en-us/azure/automation/automation-runbook-execution),configuration management with [change tracking and inventory](https://learn.microsoft.com/en-us/azure/automation/change-tracking/overview?tabs=python-2),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