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 NameIf (!($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-AdminFlowIf (!($Flows)) { Write-Host "No flows found - exiting"; break }$Report = [System.Collections.Generic.List[Object]]::new()ForEach ($Flow in $Flows){Write-Host "Processing" $Flow.DisplayNametry{$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.DisplayNameCreator = $DisplayNameUPN = $UPNConnectors = $ConnectorNamesFlowId = $Flow.FlowNameState = $Flow.EnabledCreatedTime = Get-Date($Flow.CreatedTime) -format gEnvironment = $Environment.DisplayName}$Report.Add($FlowDetail)}$Report | Out-GridView
Attribution
Author
Office365itpros