Generating Power Platform Solution Reports using PowerShell

Loading

Power Platform solutions contain important components such as tables, flows, apps, and security roles. Using PowerShell, administrators can generate solution reports to track solution components, dependencies, versions, and deployment status.


Step 1: Install and Import Required PowerShell Modules

Before running commands, ensure that you have the required PowerShell modules installed.

# Install Power Platform PowerShell modules if not already installed
Install-Module -Name Microsoft.PowerApps.Administration.PowerShell -Scope CurrentUser -Force
Install-Module -Name Microsoft.PowerApps.PowerShell -Scope CurrentUser -Force

# Import the modules
Import-Module Microsoft.PowerApps.Administration.PowerShell
Import-Module Microsoft.PowerApps.PowerShell

Step 2: Authenticate to Power Platform

Connect to your Power Platform environment using an administrator account.

# Connect to Power Platform
Add-PowerAppsAccount

For service principal authentication:

$AppId = "YOUR_APP_ID"
$TenantId = "YOUR_TENANT_ID"
$CertificateThumbprint = "YOUR_CERT_THUMBPRINT"

Connect-AdminPowerAppEnvironment -ApplicationId $AppId -TenantId $TenantId -CertificateThumbprint $CertificateThumbprint

Step 3: List All Available Solutions

Retrieve a list of all solutions in your Power Platform environment.

# Get all solutions
$solutions = Get-AdminPowerAppSolution
$solutions | Format-Table DisplayName, SolutionUniqueName, Version, PublisherName, IsManaged

To filter a specific solution:

$solutionName = "YourSolutionName"
$solution = Get-AdminPowerAppSolution | Where-Object { $_.DisplayName -eq $solutionName }
$solution

Step 4: Get Solution Components

Retrieve details about solution components, including tables, flows, and apps.

# List components in a specific solution
$solutionId = $solution.SolutionUniqueName

Get-AdminPowerAppSolutionComponent -SolutionName $solutionId | Format-Table ComponentType, Name, ObjectId

Common Component Types and IDs

Component TypeID
Canvas App300
Flow (Power Automate)400
Table (Dataverse)600
Security Role900
Business Rule1000

Step 5: Export Solution Report to CSV

Generate a detailed report containing solution information.

$solutions | Select-Object DisplayName, SolutionUniqueName, Version, PublisherName, IsManaged | 
Export-Csv -Path "C:\PowerPlatform\SolutionReport.csv" -NoTypeInformation

To export component details:

$components = Get-AdminPowerAppSolutionComponent -SolutionName $solutionId
$components | Export-Csv -Path "C:\PowerPlatform\SolutionComponents.csv" -NoTypeInformation

Step 6: Retrieve Solution Dependencies

List dependencies between solution components.

# Get dependencies for a specific solution
Get-AdminPowerAppSolutionDependency -SolutionName $solutionId | Format-Table RequiredComponent, DependentComponent

Export dependencies to a CSV file:

Get-AdminPowerAppSolutionDependency -SolutionName $solutionId | 
Export-Csv -Path "C:\PowerPlatform\SolutionDependencies.csv" -NoTypeInformation

Step 7: Check Solution Version History

To track solution version updates:

$solutions | Select-Object DisplayName, SolutionUniqueName, Version, CreatedTime, ModifiedTime |
Export-Csv -Path "C:\PowerPlatform\SolutionVersionHistory.csv" -NoTypeInformation

Step 8: Generate Environment-Wide Solution Report

To generate a full report of all solutions across all Power Platform environments:

# Get all environments
$environments = Get-AdminPowerAppEnvironment

# Loop through each environment and get solutions
foreach ($env in $environments) {
$solutions = Get-AdminPowerAppSolution -EnvironmentName $env.EnvironmentName
$solutions | Select-Object @{Name='Environment';Expression={$env.DisplayName}},
DisplayName, SolutionUniqueName, Version, PublisherName, IsManaged |
Export-Csv -Path "C:\PowerPlatform\AllEnvironmentSolutions.csv" -Append -NoTypeInformation
}

Step 9: Disconnect Session (Optional)

After generating reports, disconnect the Power Platform session.

Disconnect-AdminPowerAppEnvironment

Leave a Reply

Your email address will not be published. Required fields are marked *