Search code examples
azurewebhooksazure-logic-appsazure-automation

I want to automate Azure ARM/ASM VM start/stop by just sending a mail to specific person for any VM


Currently, In Azure ARM I have deployed

  • Automation account with a PowerShell Runbook consist of script to start/stop a Virtual Machine.
  • Created a Webhook for PowerShell Runbook
  • Created a Logic App and added the connection to O365 account to get access of mail box. Whenever a mail will come from a particular user (example@contoso.com), the logic app will extract the keyword from mail's subject.

Right now, I am able to start/stop the VM by just sending a mail along with a Keyword Start VM Name successfully.Logic app is extracting the keyword from mail's subject,then if the subject will match the condition then it will trigger a HTTP Webhook defined in logic app which will further trigger the PowerShell Runbook and then the VM will start/stop.

Currently I can start/stop a single VM only as I am not able to pass the value to Runbook so, I am using static value inside the Runbook, but I want to implement it for Multiple VMs by passing the Keyword from Logic App to PowerShell Runbook so that I can use the keyword inside PowerShell to perform the action accordingly.

Please find the screen shot of Logic App:

Screen Shot of Logic App Designer in Azure Portal


Solution

  • There is an azure automation connector that will let you pass in parameters and leverage hybrid workers for runbooks. Will be global by end of week - you can access today in some regions like Brazil South