Collaborate, Innovate, Automate

Get-EnvironmentFlowInventory

This PowerShell script produces a full inventory of every cloud flow in a single Power Platform environment — display name, flow GUID, state, owner, trigger type, and timestamps — exported to CSV. It's a lighter-weight starting point than Get-FlowConnectionOwnershipAudit or Get-FlowsByPersonConnection: no connection joins, no flagging, just a straightforward baseline of what flows exist in an environment and who owns them, which is a useful first pass before running either of those deeper audits.

Purpose

Scope

Prerequisites

PowerShell Script

<#
.SYNOPSIS
    Exports an inventory of all cloud flows in one Power Platform environment to CSV.
    Set the two variables below, then run the script.
#>

# ======================= SETTINGS: EDIT THESE =============================

# >>> PASTE THE ENVIRONMENT ID (GUID) BETWEEN THE QUOTES <<<

$EnvironmentName = ""

# Where the CSV will be saved
$OutputPath = "C:\Temp"

# ==========================================================================

if ([string]::IsNullOrWhiteSpace($EnvironmentName)) {
    Write-Host "Please set `$EnvironmentName at the top of the script first." -ForegroundColor Yellow
    return
}

# --- Module -------------------------------------------------------------
if (-not (Get-Module -ListAvailable -Name Microsoft.PowerApps.Administration.PowerShell)) {
    Install-Module -Name Microsoft.PowerApps.Administration.PowerShell -Scope CurrentUser -Force
}
Import-Module Microsoft.PowerApps.Administration.PowerShell

# --- Sign in (needs Power Platform admin rights to see other people's flows) ---
Add-PowerAppsAccount

# --- Get the flows ------------------------------------------------------
$flows = Get-AdminFlow -EnvironmentName $EnvironmentName

Write-Host "Found $(@($flows).Count) flow(s)." -ForegroundColor Cyan

$inventory = foreach ($flow in $flows) {
    $props = $flow.Internal.properties

    [pscustomobject]@{
        DisplayName   = $flow.DisplayName
        FlowName      = $flow.FlowName          # the flow's GUID
        State         = $props.state            # Started / Stopped / Suspended
        OwnerUPN      = $flow.CreatedBy.userPrincipalName
        OwnerObjectId = $flow.CreatedBy.userId
        CreatedTime   = $flow.CreatedTime
        LastModified  = $flow.LastModifiedTime
        TriggerType   = ($props.definitionSummary.triggers | ForEach-Object { $_.type }) -join "; "
        Environment   = $EnvironmentName
    }
}

# --- Output -------------------------------------------------------------
if (-not (Test-Path $OutputPath)) { New-Item -ItemType Directory -Path $OutputPath | Out-Null }

$csvPath = Join-Path $OutputPath ("FlowInventory_{0:yyyy-MM-dd}.csv" -f (Get-Date))

$inventory | Sort-Object DisplayName | Export-Csv -Path $csvPath -NoTypeInformation -Encoding UTF8

$inventory | Sort-Object DisplayName | Format-Table DisplayName, State, OwnerUPN, LastModified -AutoSize
Write-Host "Saved to $csvPath" -ForegroundColor Green

Usage Notes

Related