PowerPlatform : PowerAutomate – PowerShell script to list all PowerAutomates / Flows in a tenant and export to CSV file

Hi All,
Greetings for the day 🙂 LIFE IS BEAUTIFUL 🙂
Today one more PowerShell script along with Power Automate
Background : My management need all the list of Power Automates implemented in the tenant so this script born 🙂 Even though small script but sharing. SHARING IS CARING
Details / Steps :
- We will use
Get-AdminFlow
CMDLET to return list of all flows in tenant - Permissions required :
- Global Administrator
- Environment Administrator
- Power Platform Administrator
$powerAutomates = Get-AdminFlow
- Once we have list of Power Automates from tenant, we will loop through each Power Automate and get the details as
# loop through each power automate
foreach ($powerAutomate in $powerAutomates)
{
#Get the user from Created By field of Power Automate
$user = Get-UsersOrGroupsFromGraph -ObjectId $powerAutomate.CreatedBy.userId
#prepare the row to write the details in CSV file
$row = @{
ResourceType = 'PowerAutomate'
DisplayName = $powerAutomate.displayName
EnvironmentName = $powerAutomate.environmentName
CreatedByEmail = $user.DisplayName
}
$powerAutomateListings+= $(new-object psobject -Property $row)
}
- Lets see the PowerAutomate object details – which properties are exposed.

- Here we are using Get-UsersOrGroupsFromGraph CMDLET to get the user object. So that we can have user display name

- Final step is write to CSV file using Export-Csv CMDLET
# output to file on given Path
$powerAutomateListings | Export-Csv -Path $Path
Complete PowerShell script:
<#
Outputs a .csv file of records that represent list of PowerAutomates from the tenant it is run in. Result feature records will include:
- PowerAutomate display name
- Environment Name
- User display name who created the Power Automate
#>
param(
[string]$Path = 'c:\List_PowerAutomate_Details.csv'
)
#Get all PowerAutomates the Tenant - with proper respective permissions
# Global Administrator
# Environment Administrator
# Power Platform Administrator
$powerAutomates = Get-AdminFlow
$powerAutomateListings = @()
# loop through each power automate
foreach ($powerAutomate in $powerAutomates)
{
#Get the user from Created By field of Power Automate
$user = Get-UsersOrGroupsFromGraph -ObjectId $powerAutomate.CreatedBy.userId
#prepare the row to write the details in CSV file
$row = @{
ResourceType = 'PowerAutomate'
DisplayName = $powerAutomate.displayName
EnvironmentName = $powerAutomate.environmentName
CreatedByEmail = $user.DisplayName
}
$powerAutomateListings+= $(new-object psobject -Property $row)
}
# output to file on given Path
$powerAutomateListings | Export-Csv -Path $Path
Knowledge Junction has various PowerShell cmdlet in its Kitty, please have a look – https://knowledge-junction.in/category/technology-articles/powershell-cmdlets/
Thanks for reading 🙂 If its worth at least reading once, kindly please like and share 🙂 SHARE ING IS CARING 🙂
You must log in to post a comment.