LogicApp on Azure: turn on and off your virtual machines with a simple email
One of the most demanded things in these times is to know how to automate all your processes as much as possible, whether it’s turning on a virtual machine or deploying an app. One of the tools that Azure has to do this in a very intuitive way is LogicApp.
Azure Logic Apps is a cloud service that helps you to schedule, automate and organize tasks, business processes and workflows when you need to integrate applications, data, systems and services in companies or organizations.
This post will serve as an introduction with a practical example.
The most important term is “workflow”, this means that, by using a trigger, we will unleash different actions and we will be able to modify their behavior by use of instructions.
We will then create a LogicApp and design it to turn a machine on and off when sending an email.
First we will create the LogicApp, for the moment only putting the name and the region will be enough:
We open the resource and it will send us to the design window:
The first step is to choose a trigger with which we will launch the following steps, we will choose “When a new email is received (V2)”.
We will connect the email account you will need to check to activate the following steps.
We will create a next step that will be of type Control, this will allow us to choose certain information of the email to be able to unleash the following steps.
In Control we have several Actions. We chose Switch.
Here we can choose a value of the email and according to its value, do one thing or another. Click on On and the following window will appear. We choose, for example, Subject.
As in this case we want to turn on or off a virtual machine, we will add a new Case. Each Case is equivalent to the value that the Subject of the email must have in order to do one thing or another.
Now, we create an action for each case.
Now we send an email with the subject “Turn on VM-NAT machine”. As we can see, the trigger has been activated correctly.
And the machine has been turned off. In the same way, we could turn the machine off.
Although this example is basic, it can give you an idea of the way you can complicate it either by copying files to storage blobs automatically, deployment schedules, etc.
If you have any questions you can ask us through a comment or by our contact form.
Leave a Reply