I am looking for a way to use email trigger in order to stop/start a virtual machine. Like when I enter some kind or a keywork in the subject or the body of an email, the runbook triggers and does the stop/start.

I have seen a way to use Microsoft Flow to push buttons which triggers the runbook in Azure Automation and the VM stops in it.

Can the email option be achieved with Azure Automation?


You can't achieve this directly in Azure Automation, the only triggers it accepts are either time based, or a webhook. The way to do this would be to have a flow that is triggered by the email, and have it call the Azure Automation webhook.

| improve this answer | |
  • Thank you Sam. So I have an Azure automation account. I have a runbook within it which will stop a VM which the runbook is run. I have created a new webhook, which has a name and a URL. I would like to create a flow which will work like this. I send an email to my email address with a subject "Start XX VM" and the flow which contains the webhook should trigger and execute the runbook, which will start the VM eventfully. Can you please guide ? – Avinash Varma Jul 3 at 10:06

According to your comments, you can use a Logic App to trigger your e-mail when arriving to your mailbox, you should manager all information in field subject and then call Webhook.

Example how to trigger e-mail (it is limited to Outllok.com, O365, Gmail mails I guess)


Once you have a trigger to monitor your e-mails, you can create an Action to start it, the same logic is used to stop it, you need to create a condition when trigger your e-mail to verify subject if it contains START or STOP plus VM_NAME (something like this).

Basically an e-mail arrives (Trigger by Logic App), Logic App verifies field subject of your e-mail, according to your condition (Start VM XXX or Stop VM XXX) for subject field, you create a IF/ELSE condition, so when it trues you start it and false you stop it using HTTP request to call Webhook.

Example how to use Webook action

enter image description here

Create a new Logic App (Blank) and play with this, it is not so hard to understand how it works, there are a bunch of options and they are intuitive :)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.