When I execute the Remove-AzRoleAssignment command, it requires the ObjectId parameter. Is this the same as the PrincipalId?

Boran Yang (Shanghai Wicresoft Co Ltd) 0 Reputation points Microsoft Vendor
2024-08-27T03:31:19.29+00:00

I need to execute Remove-AzRoleAssignment to remove some role assignments, but I only have the PrincipalId, RoleId, and Scope parameters. I don't have the ObjectId. I saw in the documentation that PrincipalId seems to be an alias for ObjectId, but I'm not sure if this can be used in the Remove-AzRoleAssignment command.

Azure Role-based access control
Azure Role-based access control
An Azure service that provides fine-grained access management for Azure resources, enabling you to grant users only the rights they need to perform their jobs.
790 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Stanislav Zhelyazkov 23,501 Reputation points MVP
    2024-08-27T06:35:21.88+00:00

    Hi,

    Yes, overall you can execute Get-AzRoleAssignment to check if it will be successful with that principal ID and after that you can proceed to using Remove-AzRoleAssignment.

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.