`az role assignment create` returns wrong role assignment when `--assignee-object-id` is used
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
Found this bug when trying to repro https://github.com/Azure/azure-cli/issues/18616.
When `--assignee-object-id` is used and the role assignment exists, the returned role assignment is wrong:
```
> az role assignment create --role "Owner" --assignee-object-id e18550b3-9be1-4b97-85cd-0a87f849bbf2
{
"canDelegate": null,
"condition": null,
"conditionVersion": null,
"description": null,
"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Authorization/roleAssignments/d320644f-c08b-47f4-ae3b-9df595a5c368",
"name": "d320644f-c08b-47f4-ae3b-9df595a5c368",
"principalId": "0a592c45-613e-4f1b-9023-7c4414fd53bf",
"principalName": "fey_microsoft.com#EXT#@AzureSDKTeam.onmicrosoft.com",
"principalType": "User",
"roleDefinitionId": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Authorization/roleDefinitions/8e3af657-a8ff-443c-a75c-2fe8c4bcb635",
"roleDefinitionName": "Owner",
"scope": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590",
"type": "Microsoft.Authorization/roleAssignments"
}
```
Notice the `principalId` and `--assignee-object-id` doesn't match.
Contributor guide
Assessment
This issue has not been assessed yet.