- Print
- DarkLight
- PDF
Using Azure Logic Apps Automation Tasks to Manage Virtual Machines
- Print
- DarkLight
- PDF
Automation within Azure is nothing new. We can call Azure Automation Runbooks and can also subscribe to events using Event Grid and other serverless technologies. A popular theme, within Azure, is more and more services are including Automation Tasks. What Microsoft has started to do is include automation templates that are contextually aware (or relevant) to the service that you are managing.
Currently the following services provide Automation Task integration:
In addition, the Azure Messaging team recently announced support for Automation Tasks at the Ignite 2021 conference.
The scenario I want to focus on in this post is Azure Virtual Machine tasks. We can use these tasks when automating the start and stop of machines for our Robotic Process Automation (RPA) processes. If we only need our RPA bots to run during the day, there is no point having them run during the evening and running up Azure compute bills.
To set up an Azure Logic Apps Automation Task, we need to navigate to our Azure Resource. In this case it will be my virtual machine. Once we open the properties for our VM, we can scroll down in the left navigation and find our Automation Task. Click the link to continue.
Now we need to click Add a task to proceed.
We will now be presented with the various templates that we can use. In our scenario, we will select Start Virtual Machine.
We now need to establish connections. We can re-use existing connections or create new. Once connections are established, click Next: Configure button.
Next up, we need to establish our schedule. In our scenario we will have it run every day at 12:00 pm. In addition, we can choose to the automation job notify us of success/failure by enabling Notify Me and providing an email address. Click Next: Review + Create to proceed.
Click Create to provision your logic app.
We will now see our new Automation Task available to us. We have a couple management options that we can take advantage of. If we want to view the run history of a particular execution, we will be able to find it in the View link. In addition, if we need to make any changes to our Logic App, we can Open in Logic Apps where we can make changes to it as necessary.
Since we chose to receive email notifications, after our Automation Task runs, we view the status of the execution through our email.
We can now go through a similar process to create a job that will shut down our VM.
Conclusion
While automating tasks in Azure is nothing new, what is interesting about this approach is how simple it is using Azure Logic Apps. If you would like to see this content in video format, please check out the following YouTube video: Using Azure Logic Apps Automation Tasks to Manage RPA VMs.