We have Dynamics 365 and we also develop and run PowerApps apps and PowerAutomate flows. We want to analyze dataverse usage, get to know the list of entities and attributes that are used. We want to automate this process: retrieve analytics via API calls from PowerShell, store the results in a db and analyze history.
Here is a high level code, courtesy of Claude.ai:
# Import required modules
Install-Module -Name Microsoft.PowerApps.Administration.PowerShell
Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber
# Connect to your Power Platform environment
Add-PowerAppsAccount
# Set your environment ID
$environmentId = "your-environment-id"
# Get Usage Analytics data
$usageAnalytics = Get-PowerAppAnalyticsEntityUsageMetrics -EnvironmentId $environmentId (period parameters here..)
# Process Usage Analytics data
$usedEntities = @()
$usedAttributes = @()
foreach ($entity in $usageAnalytics.Entities) {
$usedEntities += $entity.EntityName
foreach ($attribute in $entity.Attributes) {
$usedAttributes += "$($entity.EntityName).$($attribute.AttributeName)"
}
}
Has anybody worked some sort of solution like this?
Looking for any feedback on this to support ideation over here.
Thank you very much!