Back to script library
Entra / Microsoft 365 · Applications

Get Power Automate flows

Report connectors used by Power Automate flows in a tenant to help plan Data Loss Prevention policies.

Connect & set up

Run these once per session. All scopes are read-only unless the script makes changes.

# Review required modules and connection steps before running.
# Connect to Microsoft Graph or Exchange Online as needed for this script.

Run it

The main script. Copy it, or download the .ps1 and run it from your console.

$ModulesLoaded = Get-Module | Select Name
If (!($ModulesLoaded -match "AzureAD")) {Write-Host "Please connect to the Azure AD module and then restart the script"; break}
# OK, we seem to be fully connected and ready to go...
Write-Host "Finding flows in the tenant"
[array]$Flows = Get-AdminFlow
If (!($Flows)) { Write-Host "No flows found - exiting"; break }
$Report = [System.Collections.Generic.List[Object]]::new()
ForEach ($Flow in $Flows){
Write-Host "Processing" $Flow.DisplayName
try{
$User = Get-AzureADUser -ObjectId $Flow.CreatedBy.ObjectId
$DisplayName = $User.DisplayName
$UPN = $User.UserPrincipalName
}
catch{
$DisplayName = "Unknown user"
$UPN = $Null
}
# Retrieve additional details for the Connector Overview
$FlowDetails = Get-AdminFlow -FlowName $Flow.FlowName -EnvironmentName $Flow.EnvironmentName
$Environment = Get-AdminPowerAppEnvironment $Flow.EnvironmentName
$ConnectorData = $FlowDetails.Internal.Properties.ConnectionReferences
$ConnectorNames = [System.Collections.Generic.List[Object]]::new()
ForEach ($C in $ConnectorData.PSObject.Properties) { $ConnectorNames.Add($C.Value.DisplayName) }
$ConnectorNames = $ConnectorNames -Join ", "
$FlowDetail = [PSCustomObject][Ordered]@{
Flow = $Flow.DisplayName
Creator = $DisplayName
UPN = $UPN
Connectors = $ConnectorNames
FlowId = $Flow.FlowName
State = $Flow.Enabled
CreatedTime = Get-Date($Flow.CreatedTime) -format g
Environment = $Environment.DisplayName
}
$Report.Add($FlowDetail)
}
$Report | Out-GridView
Attribution