Integrate Power automate with azure runbooks when a user submits response on Microsoft forms.

Nagaraj Kadade 20 Reputation points
2025-07-29T12:01:03.71+00:00

When a user hits the request on Microsoft forms it should trigger Automation runbooks and start or stop the vms based on the input.

1)I am able to start/stop vms on runbooks based on the tag values.

2)I am thinking to integrate the Microsoft forms to Power Automate and runbooks.

3)Power Automate flow should trigger the azure runbooks when a response hits on the Microsoft forms.

Please sugges if I am on the right path and also mention all the considerations.
If there are any better way to achieve this? we can also integrate this solution with logic app?

Please suggest a better and reliable solution in detail.

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
{count} votes

Accepted answer
  1. Sandhya Kommineni 245 Reputation points Microsoft External Staff Moderator
    2025-08-05T12:22:55.09+00:00

    Hi Nagaraj Kadade,

    Thanks for posting question in Microsoft Q&A portal.

    Yes, you are on the right track. Integrating Microsoft Forms with Power Automate to trigger Azure Automation runbooks is a valid approach.Below, I’ve outlined the considerations, recommended implementation, and alternative options .

    considerations:

    • Microsoft Forms does not have a native direct integration into Azure Automation runbooks. You must use an orchestration layer either Power Automate or Azure Logic Apps to: Capture the form submission Transform or map the answers into parameters Call the runbook via webhook or the Azure Automation API/connector
    • Ensure the runbook is published, tested, and accepts parameters (TagName, TagValue, Operation), with unique tag values to avoid mismatches, proper handling when no VM matches, and robust error handling in the script (e.g., try/catch, logging).
    • If the runbook needs to access firewall-protected resources (e.g., storage in a private network), use a Hybrid Runbook Worker with private endpoints or VNet integration.
    • Treat webhook URLs (with SAS tokens) like passwords if security is a concern, use Azure Functions or Logic App HTTP triggers for validation instead of exposing webhooks directly, ensure the runbook’s Managed Identity or Automation Account has the required RBAC roles (e.g., Contributor on target VMs’ resource group) and avoid storing or transmitting sensitive information in form responses.
    • Use retry policies (basic in Power Automate, advanced in Logic Apps), validate form responses before triggering the runbook, account for webhook execution timeouts by triggering long-running jobs asynchronously (e.g., via "Create Job" action), and enable runbook logging with alerts for failures.

    Recommended Power Automate Implementation Steps:

    Prepare Runbook

    • Verify your runbooks in your Azure Automation account are published and tested to start/stop VMs by accepting input parameters (Tag Name, Tag Value, Operation).

    Create Runbook Webhook

    • Create a webhook for each runbook In Power Automate
    • Azure Portal → Automation Account → Runbooks → Select runbook → Webhooks → Add Webhook → Copy URL(it includes the authentication token)

    Create Power Automate Flow

    • Trigger-When a new response is submitted (Microsoft Forms).
    • Action-Get response details (Microsoft Forms) – select Form ID.
    • Action-HTTP (built-in)
          Method: POST
        
        
          URI: <your runbook webhook URL>
        
        
          Headers: Content-Type: application/json 
        
        
          Body: {
        
        
          "TagName": "Environment",
        
        
          "TagValue": "@{body('Get_response_details')?['yourQuestionField']}", 
        
        
           "Operation": "@{body('Get_response_details')?['startOrStopField']}"
        
        
             }
        ```- Save and test by submitting the form.
      
      

    Referral documentations:

    https://learn.microsoft.com/en-us/azure/automation/learn/automation-tutorial-runbook-textual#add-code-to-start-a-virtual-machine

    https://learn.microsoft.com/en-us/azure/automation/automation-webhooks?tabs=portal#create-a-webhook

    Yes, there are better/alternative way to achieve this

    1.Power Automate ➝ Azure Function ➝ Runbook (via REST API)

    • Power Automate sends data to a secured Azure Function.
    • Function validates the request (e.g., user, action, input).
    • Then it calls the Runbook via REST API or triggers it with hybrid worker

    2.Logic App (Standard or Consumption) ➝ Azure Runbook (via API or connector)

    Yes, we can also integrate this solution with logic app.

    • Create a Logic App with the same trigger When a new response is submitted.
    • Use the built-in Azure Automation connector “Create job” or an HTTP action to call the webhook.
    • Logic Apps are often preferable for:
          Complex workflows
        
        
          Built-in Azure connectors
        
        
          Robust error handling & retry policies
        ```- You can use **Logic App** instead of Power Automate, especially for **enterprise-grade** solutions.
      
      

    If the requirement is simple, user-triggered automation with low/medium volume, Power Automate + Webhook is sufficient.

    If you need enterprise-grade reliability, enhanced security, or complex orchestration, I recommend Logic Apps with Azure Automation connector or Azure Function as an intermediary.

    Please refer below documentation for azure automation related issues:

    Explore Azure Automation with DevOps - Training | Microsoft Learn

    I hope the provided answer is helpful, do let me know if you have any further questions on this Please accept as Yes if the answer is helpful so that it can help others in the community.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Nagaraj Kadade 20 Reputation points
    2025-08-14T11:26:50.4+00:00

    Your answered has helped me to implement the solution and I am able to achieve the intended solution. Thank you!

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.