Listing All Power Automate Flows using PowerShell

Loading

Power Automate flows automate workflows between applications and services. Using PowerShell, administrators can list all flows in a specific environment, check their status, and export details for reporting.


Step 1: Install Required PowerShell Modules

Ensure you have the necessary Power Automate PowerShell modules installed:

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

If prompted, press Y to confirm installation.


Step 2: Authenticate to Power Platform

To connect to Power Automate, log in with an admin account:

Add-PowerAppsAccount

Alternatively, use Microsoft Graph for deeper access:

Connect-MgGraph -Scopes "User.Read.All", "Application.Read.All"

Step 3: List All Power Automate Flows in an Environment

To list all flows in a specific Power Platform environment:

$EnvironmentName = "<EnvironmentID>"  # Replace with your environment ID

Get-AdminFlow -EnvironmentName $EnvironmentName |
Select-Object DisplayName, FlowName, CreatedTime, LastModifiedTime, State |
Format-Table -AutoSize

This command provides:
Flow Name
Creation Date
Last Modified Date
Current State (Enabled/Disabled)


Step 4: List All Power Automate Flows Across All Environments

If you want to retrieve all flows across all environments:

Get-AdminFlow | 
Select-Object EnvironmentName, DisplayName, FlowName, CreatedTime, State |
Format-Table -AutoSize

This command provides insights into all flows across multiple environments.


Step 5: Retrieve Flow Owners and Details

To get detailed owner information for each flow:

$EnvironmentName = "<EnvironmentID>"
$FlowName = "<FlowName>"

Get-AdminFlowOwner -EnvironmentName $EnvironmentName -FlowName $FlowName |
Select-Object UserId, Role |
Format-Table -AutoSize

This command displays:
User ID
Role (Owner/Contributor)


Step 6: Export Flow Details to CSV for Reporting

To save flow details as a CSV file:

$outputPath = "C:\PowerAutomate\FlowReport.csv"

Get-AdminFlow |
Select-Object EnvironmentName, DisplayName, FlowName, CreatedTime, State |
Export-Csv -Path $outputPath -NoTypeInformation

Write-Host "Power Automate Flow report saved at: $outputPath"

The report contains:
Environment Name
Flow Name
Creation Date
Flow State


Step 7: Check the Status of a Specific Flow

To check if a specific flow is enabled or disabled:

$EnvironmentName = "<EnvironmentID>"
$FlowName = "<FlowName>"

Get-AdminFlow -EnvironmentName $EnvironmentName -FlowName $FlowName |
Select-Object DisplayName, State

Possible states:
Enabled
Suspended
Disabled


Step 8: Disconnect PowerShell Session

Once done, always disconnect from Power Platform:

Disconnect-MgGraph
Disconnect-PowerAppsAccount

Leave a Reply

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