Start and Stop Azure VMs Using PowerApps, Power Automate(formerly known as Microsoft Flow), SharePoint and Azure Automation - Part 1

I’ve been trying to figure out how I can manage my Azure VMs using PowerApps. There are probably better ways of doing this so I would like to know your ideas too.

I'll take you through what I have done.
There are four components to this:

  1. SharePoint – this has a list of VMs that I want to control from PowerApps
  2.  Azure automation process automation with Runbook and module galleries – I’m using the runbook for process automation
  3. Power Automate(formerly known as Microsoft Flow) – automate VM start and stop by integrating SharePoint and Azure Automation
  4. PowerApps – used to build Azure VM Manager
This is basically what my end result looks like:



I will break it down into different pieces covering each component separately.

1. SharePoint
This is simply just a list of machines that are under my Azure subscription which I wish to control from my PowerApps. You can read more here about how to create a SharePoint list.
In the next step, I'm using Azure Automation and runbook and module galleries to set up my scripts for starting and stopping my VMs.

2. Azure automation process automation with Runbook and module galleries
  • On your Azure Automation Account go to Runbooks under Process Automation and click Browse gallery











  • In the Browse gallery search V2 VMs, filter Type to only show Powershell Scripts, you'll find a start and stop VM Powershell Runbooks



If you don't know how to create an Azure Automation account here is a quick guide on how to - Create an Azure Automation account. I'm also using the Azure Run as Account manage my resources so you might want to read through that as well.

Since I'm using Azure Run as Account I'll edit the Powershell Runbook so that it uses my RunAsAccount to control my resources.

This is what my script looks like for Stop Azure V2 VMs after editing:

In the next post, I'll talk about how all this comes together using Flow and PowerApps.

Comments

  1. Do We have any option to check how many users are currently logged in to VM by flow ?

    ReplyDelete

Post a Comment

Popular posts from this blog

Override a System Defined Refresh button in D365O

Printing PDF Attachments in MSDyn365FO