Enumerate every user (and group) granted access to a specific enterprise app through the service principal's app role assignments.
Complexity: Beginner. Impact: access-review + audit + read-only + identity.
Why use this workflow
Enterprise applications in Entra ID (such as Workday, Salesforce, ServiceNow, or any SAML or OIDC SaaS app) are exposed to end users through app role assignments on the application's service principal. Knowing exactly who is assigned to an app is a foundational access review task.
Common triggers
- Access reviews and audit or compliance evidence (SOX, SOC 2, ISO 27001).
- License reconciliation: matching Entra assignments to SaaS vendor seat counts.
- Offboarding verification: confirming that a departing user has been removed from sensitive apps.
- Troubleshooting complaints that an app is missing from My Apps.
- Pre-migration inventory before you change group-based assignment or SSO configuration.
Many tenants have several service principals with similar names (for example, several Workday entries for SSO, provisioning, and companion apps). A correct listing first requires disambiguating which service principal you mean.
Expected outcomes
- The object ID (service principal ID) and
appIdof the target enterprise application. - A complete list of directly assigned principals (users, groups, and service principals) with display name, principal type, and object ID.
- Optionally, the fully expanded roster of users when groups are assigned (by expanding group membership).
- Exportable output (CSV or JSON) suitable for access-review evidence or ticket attachments.
Risks and considerations
- Group assignments hide users.
appRoleAssignedToreturns the assigned principal. If a group is assigned, you see the group, not its members. Expand group membership separately if you need the user-level roster. - The Assignment required setting matters. If the service principal has
appRoleAssignmentRequired = false, users may sign in without an explicit assignment. The assignment list is then not an authoritative list of actual users. - Multiple service principals with similar names. Gallery apps often create companion service principals (for example, Workday, Workday - Absence Calendar Integration, Workday Peakon Employee Voice). Confirm the
appIdbefore you assume that you picked the right one. - Deleted or orphaned principals. Assignments may reference principals that no longer exist. Handle these gracefully.
- Do not modify assignments while you enumerate. Treat this as a read-only task. Make any cleanup a separate, reviewed change.
- Data sensitivity. Assignment rosters can reveal organizational structure. Store exports according to your data-handling policy.
Required permissions
| Permission | Why it's needed |
|---|---|
| Application.Read.All | Read service principal and app role assignment data for all enterprise applications. |
| Directory.Read.All | Resolve assigned principals (users, groups, service principals) and expand group membership. |
| User.Read.All | Retrieve user details (UPN, mail, accountEnabled) when you enrich the output. |
| GroupMember.Read.All | Expand group-based assignments to the underlying user roster (optional). |
Ask Dex
Paste the prompt into a Dex conversation.
Prompt for IT admins
List every user assigned to the {app_name} enterprise application in Entra ID. Disambiguate if multiple service principals match the name, expand any assigned groups to their user members, and return a deduplicated roster with UPN, mail, account status, and whether the assignment is direct or via a group.
Manual steps (admin center)
- Sign in to the Microsoft Entra admin center as a Cloud Application Administrator (or higher).
- Go to Identity > Applications > Enterprise applications.
- In the Application type filter, choose All Applications, then search for the app name (for example,
Workday). - If several results appear, open each row and compare the Application ID on the Overview page against the vendor's expected app ID to select the correct service principal.
- On the chosen application, go to Manage > Users and groups.
- Review the assignments list. Each row shows the display name, the object type (User or Group), and the assigned app role.
- Select Download assignments in the command bar to export the list as CSV for audit or ticketing evidence.
- If any row is a group and you need the user-level list, select the group name, then open Members on the group page (or use the API or PowerShell approach for recursive expansion).
Check assignment enforcement
On the same app, go to Manage > Properties and confirm that Assignment required? is set to Yes. If it is No, the list on the Users and groups page may not reflect everyone who can use the app.
Microsoft Graph API
Step 1: Find the service principal
Filter by display name. Because gallery apps often create several service principals, review the full result set.
GET https://graph.microsoft.com/v1.0/servicePrincipals?$filter=startsWith(displayName,'{appName}')&$select=id,displayName,appId,appRoleAssignmentRequiredExample response:
{
"value": [
{ "id": "4038b01e-1d4a-48a2-a238-ae70644fdd39", "displayName": "Workday", "appId": "22bc5557-4764-432e-b39c-0fe76d2a0fd6", "appRoleAssignmentRequired": true },
{ "id": "d723c975-bba5-40a1-8cd3-8fd1ee6a9d17", "displayName": "Workday - Absence Calendar Integration", "appId": "ef604b03-3b2e-4a0b-bf9a-c7993e6b7e19", "appRoleAssignmentRequired": false }
]
}Step 2: List app role assignments
Use appRoleAssignedTo on the chosen service principal's id:
GET https://graph.microsoft.com/v1.0/servicePrincipals/{sp-id}/appRoleAssignedTo?$select=principalDisplayName,principalType,principalId,appRoleId,createdDateTimeExample response:
{
"value": [
{ "principalDisplayName": "Alex Wilber", "principalType": "User", "principalId": "315230ee-a11e-4d1c-8009-21e5152ecad3" },
{ "principalDisplayName": "Jordan Lee", "principalType": "User", "principalId": "7d6e495a-6170-45e7-8fd8-a0c160409a6a" },
{ "principalDisplayName": "Finance-Workday-Users", "principalType": "Group", "principalId": "c7e0..." }
]
}Step 3 (optional): Expand groups to users
For any row where principalType is Group, list the transitive members:
GET https://graph.microsoft.com/v1.0/groups/{group-id}/transitiveMembers/microsoft.graph.user?$select=id,displayName,userPrincipalName,accountEnabledStep 4 (optional): Enrich user detail
GET https://graph.microsoft.com/v1.0/users/{user-id}?$select=id,displayName,userPrincipalName,mail,accountEnabled,jobTitle,departmentPaging
Large tenants page their results. Follow @odata.nextLink until it is absent.
PowerShell
The Microsoft.Graph module wraps the Graph endpoints above. The steps below disambiguate by name, list assignments, and optionally expand groups to their user members.
Install and connect
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "Application.Read.All","Directory.Read.All","GroupMember.Read.All"Quick example
# Find service principal(s) by name
Get-MgServicePrincipal -Filter "startswith(displayName,'Workday')" | Select Id,DisplayName,AppId
# List direct assignments
Get-MgServicePrincipalAppRoleAssignedTo -ServicePrincipalId '4038b01e-1d4a-48a2-a238-ae70644fdd39' -All |
Select PrincipalDisplayName,PrincipalType,PrincipalIdApproach for the full roster
- Find the service principal by name, and filter on
AppIdwhen you know it. - List the assignments with
Get-MgServicePrincipalAppRoleAssignedTo. - For each assignment where
PrincipalTypeisGroup, expand the members withGet-MgGroupTransitiveMember. - Deduplicate users by UPN and export the roster to CSV.