A cloud-based identity and access management service for securing user authentication and resource access
The Forbidden response from New-AzRoleAssignment means the caller does not have sufficient permissions on the specified scope (<EP Resource Id>) to create a role assignment, even if the caller has a role like User Access Administrator elsewhere.
From the documented procedure to grant Reader on an enterprise policy, the key requirement is:
You must have
Microsoft.Authorization/roleAssignments/writepermissions, such as User Access Administrator or Owner, to complete this task.
That permission must be effective at the enterprise policy resource’s scope (or a parent scope). If the user’s User Access Administrator role is only at subscription or resource-group level that does not cover the enterprise policy resource, or is on a different subscription/tenant, the role assignment call at <EP Resource Id> will fail with Forbidden.
To resolve:
- Verify the scope of the caller’s role:
- Confirm that the identity running
New-AzRoleAssignmenthas User Access Administrator or Owner at:- the enterprise policy resource scope (
microsoft.powerplatform/enterprisepolicies), or - a parent scope (for example, the subscription or resource group that contains the enterprise policy).
- the enterprise policy resource scope (
- Confirm that the identity running
- Re-check the enterprise policy resource ID:
- Use Resource Graph Explorer as documented to locate the enterprise policy and copy its
idexactly. - Ensure that the
-Scopeparameter is set to that exactid.
- Use Resource Graph Explorer as documented to locate the enterprise policy and copy its
- Run the documented command from an identity with the required permission at that scope:
New-AzRoleAssignment -ObjectId <objId> -RoleDefinitionName Reader -Scope <EP Resource Id>
If the same user is already User Access Administrator or Owner at the enterprise policy’s subscription or resource group, the command should succeed once the correct scope is used. If not, an existing Owner/User Access Administrator at that scope must first grant the necessary role.
References: