You forgot to shutdown a virtual machine on your way home or to a date ?
don’t freak out ! there are many ways to save this moment when your heart is about to stop .
One of the ways is to install the Microsoft Azure application and follow with it .
Link for the application on play store : link
Link for the application on app store : Link
Now we are going to see another solution ,which is sending an email .
In this demo we are going to use Logic app service .
Azure Logic Apps :
Azure Logic Apps is a cloud service that helps you schedule, automate, and orchestrate tasks, business processes, and workflows when you need to integrate apps, data, systems, and services across enterprises or organizations. Logic Apps simplifies how you design and build scalable solutions for app integration, data integration, system integration, enterprise application integration (EAI), and business-to-business (B2B) communication, whether in the cloud, on premises, or both.
For example, here are just a few workloads you can automate with logic apps:
- Process and route orders across on-premises systems and cloud services.
- Send email notifications with Office 365 when events happen in various systems, apps, and services.
- Move uploaded files from an SFTP or FTP server to Azure Storage.
- Monitor tweets for a specific subject, analyze the sentiment, and create alerts or tasks for items that need review.
How do logic apps work?
Every logic app workflow starts with a trigger, which fires when a specific event happens, or when new available data meets specific criteria. Many triggers provided by the connectors in Logic Apps include basic scheduling capabilities so that you can set up how regularly your workloads run. For more complex scheduling or advanced recurrences, you can use a Recurrence trigger as the first step in any workflow. Learn more about schedule-based workflows.
Each time that the trigger fires, the Logic Apps engine creates a logic app instance that runs the actions in the workflow. These actions can also include data conversions and workflow controls, such as conditional statements, switch statements, loops, and branching. For example, this logic app starts with a Dynamics 365 trigger with the built-in criteria “When a record is updated”. If the trigger detects an event that matches this criteria, the trigger fires and runs the workflow’s actions. Here, these actions include XML transformation, data updates, decision branching, and email notifications.
With businesses moving toward digitization, logic apps help you connect legacy, modern, and cutting-edge systems more easily and quickly by providing prebuilt APIs as Microsoft-managed connectors. That way, you can focus on your apps’ business logic and functionality. You don’t have to worry about building, hosting, scaling, managing, maintaining, and monitoring your apps. Logic Apps handles these concerns for you. Plus, you pay only for what you use based on a consumption pricing model.
Let’s Do It (DEMO)
First of all , let’s create a simple logic app by following the follow instructions below :
Now , what’s the action that will do our job here ? (the job is to start or to stop a virtual machine that you may forget to stop while you were going home to see your family because you miss them after a long dat at work ).
Ps : To learn The Proper way To Shutdown Azure VM and the difference between stopped and Deallocated you can read from this LINK
Now this action we talked about is called a “Trigger ” to cause (something) to start or happen that is a trigger , in our case a trigger is : receiving an email .
First of all we are going to choose the trigger action which is “when a new email arrives(v3)” and we are going
to make a couple of parameters :
– the folder ,in our case the inbox
– From : here you can choose your own email or another email ,like a collogue or anyone who can do this to the machine
and keep other parameters as they are.
here we are choosing the subject , which is the subject of the email that is going to be received.
We have 2 cases , one to turn ON the machine and one to Stopped (deallocated) (you can add more like for restart , stop….)
In the first case I put “turnoff01” as a subject , later you need to choose your subscription
the resource group that contain the virtual machine and the virtual machine too .
In the second case I put “turnon01” as a subject and it start the machine
As you can see in the Overview , we can see sending the email have triggered the logic app , and in my case the
call to stop and to start the machine was done successfully
Leave a Reply