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 →
- Find the Graph service principal and the
GroupMember.Read.Allapp 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) - 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\"}" - Get a token for
https://graph.microsoft.comin 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.
More on Identity, Access and Governance
A new developer joins and needs to deploy to the dev resource group only. How do you give access?BeginnerYour GitHub Actions workflow uses a client secret stored in a repo secret. Security wants it gone. What do you do?BeginnerAuditors ask "who has Owner on production, and why?" How do you answer and fix it?IntermediateA VM application needs to read blobs from one container. How do you set up access without keys?IntermediateTeams keep creating resources in random regions and without tags. How do you stop it?BeginnerA contractor needs temporary read access to logs for two weeks. How do you handle it?Beginner