Use Power Apps “Launched app” audit events and select the newest event for each app; Get-AdminPowerApp returns app information but does not provide a documented last-used property.^1^
PowerShell script
The following script searches the Unified Audit Log, identifies Power Apps launch events from PropertyCollection, groups them by app ID, and exports the latest launch date.
Connect-ExchangeOnline
$start = (Get-Date).AddDays(-90).ToUniversalTime()
$end = (Get-Date).ToUniversalTime()
$session = "PowerApps-$([guid]::NewGuid())"
$events = @()
do {
$page = @(Search-UnifiedAuditLog -StartDate $start -EndDate $end `
-SessionId $session -SessionCommand ReturnLargeSet)
$events += $page
} while ($page.Count -gt 0)
$report = foreach ($event in $events) {
$data = $event.AuditData | ConvertFrom-Json
$props = @{}
foreach ($item in $data.PropertyCollection) { $props[$item.Name] = $item.Value }
if ($props['powerplatform.analytics.resource.type'] -eq 'PowerApp' -and
$props['powerplatform.analytics.activity.name'] -match 'Launch') {
[pscustomobject]@{
AppId = $props['powerplatform.analytics.resource.power_app.id']
AppName = $props['powerplatform.analytics.resource.power_app.display_name']
Environment = $props['powerplatform.analytics.resource.environment.name']
LastUsedUTC = [datetime]$event.CreationDate
}
}
}
$report | Group-Object AppId | ForEach-Object {
$_.Group | Sort-Object LastUsedUTC -Descending | Select-Object -First 1
} | Sort-Object LastUsedUTC -Descending |
Export-Csv ".\PowerApps-LastUsed.csv" -NoTypeInformation
Power Apps records identify an app through fields such as:
-
powerplatform.analytics.resource.type=PowerApp -
powerplatform.analytics.resource.power_app.id -
powerplatform.analytics.resource.power_app.display_name -
powerplatform.analytics.resource.environment.name -
powerplatform.analytics.activity.name
The recorded activity time is exposed as the audit event’s CreationDate. Power Apps auditing explicitly includes Launched app events.^2^ Audit payload details are JSON, so the script must parse AuditData and its workload-specific properties.^3^
Prerequisites
- Assign the account either the Audit Logs or View-Only Audit Logs role in Microsoft Purview.
- Ensure auditing is configured for the Power Platform production environments being monitored.^2^
- Install the Exchange Online PowerShell module if necessary, then authenticate with
Connect-ExchangeOnline. - Change
AddDays(-90)to the required reporting window. Results are limited to events still retained in the audit log, so “last used” means the last launch within the searchable retention period.
Large tenants and missing results
Search-UnifiedAuditLog returns only 100 records by default. Reusing the same SessionId with ReturnLargeSet, as the script does, retrieves pages up to the documented 50,000-result limit; those pages are unsorted.^4^
If the search reaches 50,000 records, divide the reporting period into smaller ranges—such as weekly or daily windows—and combine the results before grouping. Microsoft specifically recommends reducing the date range when the 50,000-record limit is reached.^5^
If the CSV is empty, first run a launch-event search in Microsoft Purview → Solutions → Audit, open one result, and inspect its powerplatform.analytics.activity.name value. Replace the script’s -match 'Launch' test with that exact value if needed.
Apps with no launch event in the selected or retained period cannot be assigned an exact last-used date; report those as No launch found in audit period, rather than assuming they were never used.
References