← cd ~/graph-permissions
// graph-permissions · Insights-UserMetric
Insights-UserMetric.Read.AllMicrosoft Graph permission · Medium risk
Allows an app to read all user metrics insights, such as daily and monthly active users, without a signed-in user.
Application permission
Medium riskRead all user metrics insights. Allows an app to read all user metrics insights, such as daily and monthly active users, without a signed-in user.
| ID | 34cbd96c-d824-4755-90d3-1008ef47efc1 |
|---|---|
| Consent | Always needs admin consent |
| Risk | Reads data across the tenant without a signed-in user. |
Delegated permission
Low riskRead user metrics insights. Allows an app to read user metrics insights, such as daily and monthly active users, on behalf of the signed-in user.
| ID | 7d249730-51a3-4180-8ec1-214f144f1bff |
|---|---|
| Consent | Needs admin consent |
| Risk | Read access, limited to what the signed-in user can see. |
Grant it to an app
In the portal: App registrations › your app › API permissions › Add a permission › Microsoft Graph › Application permissions, then grant admin consent. Or with Graph PowerShell:
Connect-MgGraph -Scopes "Application.Read.All", "AppRoleAssignment.ReadWrite.All"
$graph = Get-MgServicePrincipal -Filter "appId eq '00000003-0000-0000-c000-000000000000'"
$app = Get-MgServicePrincipal -Filter "appId eq '<your app's client id>'"
New-MgServicePrincipalAppRoleAssignment -ServicePrincipalId $app.Id `
-PrincipalId $app.Id -ResourceId $graph.Id -AppRoleId "34cbd96c-d824-4755-90d3-1008ef47efc1"Ask for it when signing in
Delegated permissions act as the signed-in user, so the app can never do more than that user can.
Connect-MgGraph -Scopes "Insights-UserMetric.Read.All"Which apps already have it?
# Apps that hold Insights-UserMetric.Read.All as an application permission
Connect-MgGraph -Scopes "Application.Read.All"
$graph = Get-MgServicePrincipal -Filter "appId eq '00000003-0000-0000-c000-000000000000'"
Get-MgServicePrincipalAppRoleAssignedTo -ServicePrincipalId $graph.Id -All |
Where-Object AppRoleId -eq "34cbd96c-d824-4755-90d3-1008ef47efc1" |
Select-Object PrincipalDisplayName, PrincipalId, CreatedDateTime# Apps with delegated consent for Insights-UserMetric.Read.All
Connect-MgGraph -Scopes "Application.Read.All", "Directory.Read.All"
$graph = Get-MgServicePrincipal -Filter "appId eq '00000003-0000-0000-c000-000000000000'"
Get-MgOauth2PermissionGrant -All |
Where-Object { $_.ResourceId -eq $graph.Id -and ($_.Scope -split " ") -contains "Insights-UserMetric.Read.All" } |
Select-Object ClientId, ConsentType, PrincipalId