Interview Prep/Azure/Identity and Authorization Errors

`RoleAssignmentExists: The role assignment already exists.` breaks a Terraform apply.

IntermediateTroubleshootingIdentity and Authorization Errors
Answer

Likely causes → The same principal/role/scope assignment was created outside Terraform (portal, --attach-acr, another module).

Diagnose →

az role assignment list --assignee <principalId> --scope <scope> --query "[].id" -o tsv

Fix →

  1. Import the existing assignment into state with an import block using its ID
  2. Or remove the duplicate from code if another module owns it

Prevent → One owner per role assignment; avoid mixing az aks update --attach-acr with Terraform role assignments for the same pair.

Azure All Azure questions Roadmap: Azure core services

More on Identity and Authorization Errors