Enabling Power Apps Analytics using PowerShell

Loading

Power Apps Analytics provides insights into app performance, usage, and errors. Using PowerShell, administrators can enable and retrieve analytics data to monitor Power Platform environments efficiently.


Step 1: Install Required PowerShell Modules

Ensure you have the necessary Power Platform PowerShell modules installed:

Install-Module -Name Microsoft.PowerApps.Administration.PowerShell -Force -AllowClobber
Install-Module -Name Microsoft.PowerApps.PowerShell -Force -AllowClobber

If prompted, press Y to confirm installation.


Step 2: Authenticate to Power Platform

Log in to Power Platform using an account with admin privileges:

Add-PowerAppsAccount

Alternatively, authenticate using Microsoft Graph for deeper reporting:

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

Step 3: Enable Analytics for a Power Apps Environment

To enable analytics in a specific Power Platform environment:

$environmentName = "<EnvironmentID>"  # Replace with your environment ID
Set-AdminPowerAppEnvironment -EnvironmentName $environmentName -EnableTelemetry $true

🔹 This command activates telemetry, allowing Power Platform to collect analytics on app usage and performance.


Step 4: Retrieve Power Apps Analytics Data

To check analytics for all Power Apps in an environment:

$environmentName = "<EnvironmentID>"  # Replace with your environment ID
Get-AdminPowerApp | Where-Object { $_.EnvironmentName -eq $environmentName } |
Select DisplayName, AppName, CreatedTime, LastModifiedTime, Owner |
Format-Table -AutoSize

This provides:
App Name
Owner
Creation Date
Last Modified Date


Step 5: Retrieve User Activity Logs for Power Apps

To analyze who is using Power Apps and how often:

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

🔹 This command lists all users of a specific Power App along with their roles.


Step 6: Export Analytics Data to CSV for Reporting

To save the analytics data as a CSV file for further analysis:

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

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

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

The report contains:
App Name
Owner
Creation Date
Last Modified Date


Step 7: Retrieve Error & Performance Logs

To check for app errors or performance issues:

Get-AdminPowerAppEnvironmentLog -EnvironmentName "<EnvironmentID>" -Top 10

🔹 This retrieves the last 10 logs related to performance, crashes, and errors.


Step 8: Disable Analytics (If Needed)

If you ever need to disable analytics, use:

Set-AdminPowerAppEnvironment -EnvironmentName "<EnvironmentID>" -EnableTelemetry $false

Step 9: Disconnect from Power Platform

Once done, disconnect the session:

Disconnect-MgGraph
Disconnect-PowerAppsAccount

Leave a Reply

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