![]()
Power Automate allows users to create workflows that automate repetitive tasks. Using PowerShell, administrators can enable or disable flows across environments, ensuring better control over automation processes.
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 and manage flows, log in with an admin account:
Add-PowerAppsAccount
For deeper access via Microsoft Graph, use:
Connect-MgGraph -Scopes "User.Read.All", "Application.Read.All"
Step 3: List All Power Automate Flows
Before enabling or disabling a flow, retrieve all available flows to get the exact name:
$EnvironmentName = "<EnvironmentID>" # Replace with your environment ID
Get-AdminFlow -EnvironmentName $EnvironmentName |
Select-Object DisplayName, FlowName, State |
Format-Table -AutoSize
This command provides:
Flow Name
Current State (Enabled/Disabled)
Step 4: Enable a Power Automate Flow
To enable a specific flow:
$EnvironmentName = "<EnvironmentID>" # Replace with your environment ID
$FlowName = "<FlowName>" # Replace with the exact flow name
Enable-AdminFlow -EnvironmentName $EnvironmentName -FlowName $FlowName
Write-Host "Flow '$FlowName' has been enabled."
This activates the flow and allows it to run as scheduled or triggered.
Step 5: Disable a Power Automate Flow
To disable a specific flow:
$EnvironmentName = "<EnvironmentID>" # Replace with your environment ID
$FlowName = "<FlowName>" # Replace with the exact flow name
Disable-AdminFlow -EnvironmentName $EnvironmentName -FlowName $FlowName
Write-Host "Flow '$FlowName' has been disabled."
This pauses the automation, preventing it from triggering until re-enabled.
Step 6: Verify the Flow Status
After enabling or disabling a flow, verify its status:
$EnvironmentName = "<EnvironmentID>"
$FlowName = "<FlowName>"
Get-AdminFlow -EnvironmentName $EnvironmentName -FlowName $FlowName |
Select-Object DisplayName, State
Possible states:
Enabled (Active)
Suspended (Disabled)
Step 7: Enable or Disable Multiple Flows in Bulk
To enable all disabled flows in an environment:
$EnvironmentName = "<EnvironmentID>"
Get-AdminFlow -EnvironmentName $EnvironmentName |
Where-Object { $_.State -eq "Suspended" } |
ForEach-Object { Enable-AdminFlow -EnvironmentName $EnvironmentName -FlowName $_.FlowName }
Write-Host "All disabled flows have been enabled."
To disable all enabled flows in an environment:
$EnvironmentName = "<EnvironmentID>"
Get-AdminFlow -EnvironmentName $EnvironmentName |
Where-Object { $_.State -eq "Enabled" } |
ForEach-Object { Disable-AdminFlow -EnvironmentName $EnvironmentName -FlowName $_.FlowName }
Write-Host "All active flows have been disabled."
Useful for bulk automation management during maintenance or updates.
Step 8: Disconnect PowerShell Session
Once finished, disconnect PowerShell:
Disconnect-MgGraph
Disconnect-PowerAppsAccount
