Interview Prep/Azure/Identity, Access and Governance

A managed identity needs to call Microsoft Graph to read group memberships. How do you grant it?

AdvancedScenarioIdentity, Access and Governance
Answer

Situation read → Graph application permissions for managed identities can't be granted in the portal UI; use the Graph API.

What I'd do →

  1. Find the Graph service principal and the GroupMember.Read.All app role ID:
    graphSp=$(az ad sp show --id 00000003-0000-0000-c000-000000000000 --query id -o tsv)
    roleId=$(az ad sp show --id 00000003-0000-0000-c000-000000000000 \
      --query "appRoles[?value=='GroupMember.Read.All'].id" -o tsv)
    
  2. Create the app role assignment (needs a Privileged Role Administrator or equivalent):
    az rest --method post --url "https://graph.microsoft.com/v1.0/servicePrincipals/<miObjectId>/appRoleAssignments" \
      --body "{\"principalId\":\"<miObjectId>\",\"resourceId\":\"$graphSp\",\"appRoleId\":\"$roleId\"}"
    
  3. Get a token for https://graph.microsoft.com in the app and test

Why → Graph rights are directory permissions, not Azure RBAC; Contributor on anything doesn't help.

Interview tip → Distinguishing Graph permissions from RBAC is a strong signal.

Azure All Azure questions Roadmap: Azure core services

More on Identity, Access and Governance