Monitoring Power Apps Usage using PowerShell

Loading

Monitoring Power Apps usage helps administrators track app performance, user engagement, and identify inactive apps. PowerShell provides a powerful way to automate this monitoring, allowing you to extract valuable insights from your Power Platform environment.


Step 1: Install Required PowerShell Modules

Before you begin, ensure you have the necessary PowerShell modules installed:

Install-Module -Name Microsoft.PowerApps.Administration.PowerShell -Force -AllowClobber
Install-Module -Name Microsoft.PowerApps.PowerShell -Force -AllowClobber
Install-Module -Name Microsoft.Graph -Scope CurrentUser -Force

If prompted, press Y to confirm installation.


Step 2: Authenticate to Power Platform

To connect to Power Apps, log in using an admin account with appropriate permissions:

Add-PowerAppsAccount

Alternatively, authenticate using Microsoft Graph for additional reporting options:

Connect-MgGraph -Scopes "User.Read.All", "Directory.Read.All"

Step 3: Retrieve All Power Apps in an Environment

To list all Power Apps in your environment:

Get-AdminPowerApp | Select DisplayName, AppName, Owner, CreatedTime, LastModifiedTime | Format-Table -AutoSize

This provides basic details, including:
App Name
Owner
Creation Date
Last Modified Date


Step 4: Check Power Apps Usage Metrics

To get detailed usage statistics for each app:

$apps = Get-AdminPowerApp  

$apps | ForEach-Object {
$app = $_
$usage = Get-AdminPowerAppEnvironment -EnvironmentName $app.EnvironmentName

[PSCustomObject]@{
AppName = $app.DisplayName
Owner = $app.Owner
CreatedTime = $app.CreatedTime
LastModified = $app.LastModifiedTime
Environment = $usage.DisplayName
}
} | Format-Table -AutoSize

Step 5: Identify Inactive Power Apps

If you want to find inactive apps (apps that haven’t been modified in the last 6 months):

$inactiveApps = Get-AdminPowerApp | Where-Object { $_.LastModifiedTime -lt (Get-Date).AddMonths(-6) }

$inactiveApps | Select DisplayName, AppName, Owner, LastModifiedTime | Format-Table -AutoSize

🔹 This helps identify unused apps that can be deleted or optimized.


Step 6: Export Power Apps Usage Report to CSV

To save the Power Apps usage data as a CSV file for further analysis:

$outputPath = "C:\PowerPlatform\PowerAppsUsageReport.csv"

Get-AdminPowerApp | Select DisplayName, AppName, Owner, CreatedTime, LastModifiedTime |
Export-Csv -Path $outputPath -NoTypeInformation

Write-Host "Power Apps Usage Report saved at: $outputPath"

The report will contain:
App Name
Owner
Creation Date
Last Modified Date


Step 7: Monitor User Activity in Power Apps

To check which users are actively using Power Apps:

Get-AdminPowerAppUser -AppName "<AppName>" | Select DisplayName, UserPrincipalName, Role | Format-Table -AutoSize

🔹 This helps track who is using an app and their assigned roles.


Step 8: Disconnect from Power Platform

Once you have collected your data, disconnect the session:

Disconnect-MgGraph
Disconnect-PowerAppsAccount

Leave a Reply

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