Share via

Auto Azure VMs restart

Vittal Kasaram 20 Reputation points
2026-04-07T11:37:21.19+00:00

Hi,
Logic Apps: Good if you prefer a low-code workflow with a built-in recurrence trigger and an action to restart the VM.

Could you please share me the steps or document to auto VMs restart (In Logic Apps)

Azure Logic Apps
Azure Logic Apps

An Azure service that automates the access and use of data across clouds without writing code.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Siddhesh Desai 4,895 Reputation points Microsoft External Staff Moderator
    2026-04-07T14:44:19.74+00:00

    Hi @Vittal Kasaram

    Thank you for reaching out to Microsoft Q&A.

    You have got a couple of options to auto­mate VM restarts in Logic Apps. You can deploy Microsoft’s “Start/Stop VMs v2” solution (it includes scheduled start/stop workflows you can tweak to “Restart”), or build a tiny custom Logic App yourself. Here are the steps below:

    Create a new Logic App

    In the Azure portal, go to “Create a resource” → “Logic App (Consumption)” → give it a name, resource group, region → Create.

    Add a Recurrence trigger

    In Logic Apps Designer click “+ New step” → search for “Recurrence” → choose your schedule (every day, every hour, whatever).

    Call the “Restart Virtual Machine” action

    Click “+ New step” → search for “Azure” → select “Restart virtual machine” (from the Azure Resource Manager connector).

    Sign in / create a service-principal–based connection if prompted.

    Fill in:

    • Subscription – your subscription

    • Resource group name – the RG containing the VM

    • Virtual machine name – the VM you want to restart

    Save and test

    Save the Logic App, click “Run” and check the run history to confirm your VM restarted.

    (Optional) Loop through multiple VMs

    If you need to restart a batch, add an “Initialize variable” → array of VM names, then “For each” over that array and inside the loop call the same “Restart virtual machine” action, this time using the loop variable for the VM name.

    If you’d rather start from Microsoft’s drop-in solution:

    • Deploy the “Start/Stop VMs v2” ARM template – it creates prebuilt Logic Apps for scheduled start, stop, auto-stop on CPU, and sequenced operations.

    • Once deployed, find the logic app named ststv2_vms_Scheduled_start (or ..._stop), open its designer, swap out the stop/start action for “Restart virtual machine,” adjust your recurrence, then Enable.

    Hope that gives you a quick path to auto-restarts in Logic Apps!

    Reference docs

    Azure actions for Logic Apps (start/stop/restart VMs)

    https://learn.microsoft.com/power-automate/desktop-flows/actions-reference/azure?wt.mc_id=knowledgesearch_inproduct_azure-cxp-community-insider#restart-virtual-machine

    Deploy Start/Stop VMs v2 to your subscription

    https://learn.microsoft.com/azure/azure-functions/start-stop-v2/deploy?wt.mc_id=knowledgesearch_inproduct_azure-cxp-community-insider

    Start/Stop VMs v2 overview (scheduling, sequencing, auto-stop)

    https://learn.microsoft.com/azure/azure-functions/start-stop-v2/overview?wt.mc_id=knowledgesearch_inproduct_azure-cxp-community-insider#overview

    Schedule recurring tasks in Logic Apps (Recurrence trigger)

    https://docs.microsoft.com/azure/logic-apps/connectors-native-recurrence#add-the-recurrence-trigger

    0 comments No comments

  2. Q&A Assist
    2026-04-07T11:37:35.0566667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To automatically restart Azure VMs using Logic Apps, use the built-in Automation Tasks for virtual machines, which create a Logic Apps workflow for you and can then be customized.

    Follow these steps:

    1. In the Azure portal, open the Virtual machine that needs automatic restart.
    2. In the VM’s left menu, look for Automation or Automation tasks (under the resource’s management section).
    3. Select Automation tasks.
    4. From the list of templates for Azure virtual machines, choose a task template that controls power state, for example:
      • Start Virtual Machine (for starting on a schedule)
      • Power off Virtual Machine or Deallocate Virtual Machine (if also needed)
    5. Create the task:
      • Give the task a name.
      • On the Configure tab, set the Interval and Frequency (for example, every 1 Day, or every 1 Week) to define how often the action runs.
      • Complete any required connections/authorizations.
    6. Save the task. This creates an underlying Logic Apps workflow with:
      • A Recurrence trigger (the schedule)
      • An action that calls the VM power operation (start/stop/deallocate)
    7. If needed, open the created Logic App in the Logic Apps designer to further customize the workflow (add conditions, notifications, etc.).

    This approach uses Logic Apps with a recurrence trigger and VM power actions, but the portal’s Automation Task templates handle the wiring for Azure VMs automatically.


    References:

    0 comments No comments

Your answer

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