How to Delete Multiple Power Automate Flows Using PowerShell

In this blog post, we will walk through the steps to delete multiple Power Automate flows using PowerShell.

Power Automate (formerly known as Microsoft Flow) is a cloud-based service that allows you to create automated workflows between various applications and services. If you are working with a large number of flows, it can become cumbersome to delete them one by one from the Power Automate web portal. PowerShell is a powerful command-line tool that can automate administrative tasks, including deleting multiple Power Automate flows at once.

Install the Power Automate PowerShell module

Before you can use PowerShell to manage your Power Automate flows, you need to install the Power Automate PowerShell module. Open a PowerShell console with administrative privileges and run the following command:


Install-Module -Name Microsoft.PowerApps.Administration.PowerShell -force
Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber

To connect to the Power Platform using PowerShell., run the following command.

Add-PowerAppsAccount

Get a list of flows

To get a list of all your flows, run the following command and note the FolwName details of the flows you would like to delete.

Note: Note down the environment name

Get-AdminFlow | Select-Object FlowName, Enabled, DisplayName, EnvironmentName | ft -AutoSize 

Delete Folws

In the code, below, we are using a PowerShell array to store all the flows we would like to delete.


$envname = "environment-details"
$flowsdodelete = @("0c23ca8f-2b8f-40f4-85ac-0a7f43e8f4bc", "36405266-7fcc-4667-95b8-baac330baa6d")


foreach ($item in $flowsdodelete) {
    Remove-AdminFlow -FlowName $item -EnvironmentName $envname -Verbose -Debug 
  
  }

Save the code above a PowerShell script and run.

Processing…
Success! You're on the list.

Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.