Published on

Bro—where are my rolls?

Authors

Hi. Writing this so future Reed (and others) can remember the difference between scopes, roles, and wids (well-known IDs) in the context of Microsoft graph activity logs.

To test, I registered four different app in my tenant with different RBAC configurations. The permissions used didn't really matter, but I was testing Intune already so I decided to use those permissions. Here are the results of the testing for where and why each permission shows up.

This table expects you are familiar with the different ways you can configure RBAC within Entra ID. If I'm missing a specific scenario—please let me know so I can re-test and update the chart.

Tests and Findings

ApplicationRBAC SetupFieldGraph PermissionWhy?
🥐 Dinner RollApplication PermissionsRolesDeviceManagementManagedDevices.ReadWrite.AllSince this is an application-only token—there are no scopes and the roles section is populated which was confusing to me since this is not the location of directory roles (these are in Wids).
🧺 Bread BasketApplication Permissions with Directory RoleRoles + WidsDeviceManagementManagedDevices.Read.All + Intune AdministratorSimilar to above. We can also see the Service Principal has the Intune Admin role in the Wids field.
🧑‍🍳 Roll MakerDelegated PermissionsScopesDeviceManagementManagedDevices.PrivilegedOperations.AllSince a user has to be associated with delegated permissions—Scopes will be populated because they (along with what the application can access) define effective access.
🐴 Roll EaterDelegated Permissions with Directory Role on userScopes + WidsDeviceManagementManagedDevices.Read.All + Intune AdministratorSimilar to above. We also get the user's roll in the Wids field.

Abbreviated Graph Log Examples

AppApiVersionRequestMethodResponseStatusCodeUserAgentRequestUriDurationMsResponseSizeBytesRolesDeviceIdUniqueTokenIdUserIdServicePrincipalIdScopesClientAuthMethodWidsType
🥐 Dinner Rollv1.0GET200curl/8.5.0https://graph.microsoft.com/v1.0/deviceManagement/managedDevices?$top=1&$select=id,deviceName,complianceState818567502DeviceManagementManagedDevices.ReadWrite.Allf816b226-...10997a1d0-0d1d-4acb-b408-d5ca73121e90MicrosoftGraphActivityLogs
🧺 Bread basketv1.0GET200curl/8.5.0https://graph.microsoft.com/v1.0/deviceManagement/managedDevices?$top=1&$select=id,deviceName,complianceState3834924502DeviceManagementManagedDevices.Read.All032fa0ba-...13a2c62db-5318-420d-8d74-23affee5d9d5 0997a1d0-0d1d-4acb-b408-d5ca73121e90MicrosoftGraphActivityLogs
🧑‍🍳 Roll Makerv1.0GET200curl/8.5.0https://graph.microsoft.com/v1.0/deviceManagement/managedDevices?$top=1&$select=id,deviceName,complianceState1291164502meDeviceManagementManagedDevices.PrivilegedOperations.All DeviceManagementManagedDevices.Read.All profile openid email062e90394-69f5-4237-9190-012177145e10 3a2c62db-5318-420d-8d74-23affee5d9d5 b79fbf4d-3ef9-4689-8143-76b194e85509MicrosoftGraphActivityLogs
🐴 Roll Eaterv1.0GET200curl/8.5.0https://graph.microsoft.com/v1.0/deviceManagement/managedDevices?$top=1&$select=id,deviceName,complianceState1246434502meDeviceManagementManagedDevices.Read.All profile openid email062e90394-69f5-4237-9190-012177145e10 3a2c62db-5318-420d-8d74-23affee5d9d5 b79fbf4d-3ef9-4689-8143-76b194e85509MicrosoftGraphActivityLogs

Why is this important?

Knowing how these show up in logs will ensure you have an accurate understanding of the permissions certain objects have during an investigation or threat hunts. I hope this table also helps other threat hunters create detections and investigate overly permissioned workload identities within their tenant.

You should be ingesting graph activity logs if you have the means to! They give a great unified view into activity across a tenant. Lookout for a follow-up post next month that looks at how you infer activity based on specific Graph endpoints to hunt within your tenant without having to ingest separate diagnostic logs.

Side things

I didn't realize it--but it seems like Graph will bundle permissions together, but display two different permissions in activity logs. Just something to keep in mind—I have not enumerated all the possibilities here but they should at least be accurate. Splits seems to happen like this:

DeviceManagementManagedDevices.PrivilegedOperations.All
|
(becomes)
|
|_ DeviceManagementManagedDevices.PrivilegedOperations.All
|_ DeviceManagementManagedDevices.Read.All

Also, the ClientAuthMethod field is pretty useful here to distinguish the authorization method used outlined here

0: public client
1: client secret
2: client certificate

Anyways, thanks for readin'—stay safe out there keyboard cowboy...

Script if you'd like to test yourself

gist