AzureMid
PrincipalNotFound when assigning a role to a new identity
A role assignment right after creating a user or service principal can fail from replication delay. Set principalType, or wait before assigning.
What you see
PrincipalNotFoundfollowed byPrincipal {principalId} does not exist in the directory {tenantId}. Check that you have the correct principal ID. If you are creating this principal and then immediately assigning a role, this error might be related to a replication delay.
What it means
The new principal was created in one region. The role assignment can happen in another region that has not replicated it yet. So the assignment sometimes fails and sometimes works.
How to confirm the cause
- 1Confirm the principal ID is correct
az ad sp show --id APP_OR_OBJECT_ID
Use the matching
az ad user showoraz ad group showfor users and groups.
Causes and fixes
Replication delay
- HOW TO TELL
- The ID is right, the principal was created seconds ago.
- FIX
- Set the
principalTypeproperty when creating the role assignment (Userneeds API version 2020-03-01-preview or later;ServicePrincipalneeds 2018-09-01-preview or later). In PowerShell set-ObjectTypetoUserorServicePrincipal. For a new group, wait a few minutes.
Using --assignee with a service principal that cannot read Entra ID
- HOW TO TELL
Insufficient privileges to complete the operationwhen the CLI runs as a service principal.- FIX
- Pass the object ID instead of a name so the CLI skips the Entra lookup, or give the service principal the Directory Readers role.
az role assignment create --assignee-object-id OBJECT_ID --role "Contributor" --scope "/subscriptions/SUBSCRIPTION_ID/resourceGroups/RESOURCE_GROUP"
How to stop it coming back
- Always set
principalTypein templates and pipelines that create identities and assign roles in the same run.
Keep going
- Runbook: Azure AuthorizationFailed: the client does not have authorization
- Cheat sheet: Azure CLI
- Lesson: the iac topic in Learn
Sources
Microsoft Learn (learn.microsoft.com), read 18 Nov 2026. The page's own metadata shows it was last updated 5 Nov 2026.