Azure / Azure/azure-cli

'az role assignment list' gives wrong feedback

Open
#21,020 8 comments 3 reactions 1 assignee Claimed by @jiasli View on GitHub
act-identity-squad bug customer-reported feature-request Microsoft Graph RBAC
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

**Context**:
I need to clean up role assignments using CLI because Azure does not remove them itself when removing the identity.
When running the following command on an Azure DevOps Hosted Agent:

`az role assignment list --assignee $principalId --all`

**Result**
The CLI gives the following feedback:
`Failed to query xxxx-xxxx-xxxx-xxxx by invoking Graph API. If you don't have permission to query Graph API, please specify --assignee-object-id and --assignee-principal-type.`
`WARNING: Assuming xxxx-xxxx-xxxx-xxxx as an object ID.`

**Problem:**
`assignee-object-id` and `assignee-principal-type` are not valid parameters for `az role assignment list`.
If used. The following is returned:
`unrecognized arguments: --assignee-principal-type ServicePrincipal --assignee-object-id xxxx-xxxx-xxxx-xxxx`

(Thankfully using the principalId as ObjectId appearantly works. But we really want to get rid of the warnings in our DevOps dashboard..)

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 9dacfad8-cb2f-2534-3b29-89b0930a2252
* Version Independent ID: 17325cd4-44c5-4069-d9f6-940a55f0f7c9
* Content: [az role assignment](https://docs.microsoft.com/en-us/cli/azure/role/assignment?view=azure-cli-latest)
* Content Source: [latest/docs-ref-autogen/role/assignment.yml](https://github.com/MicrosoftDocs/azure-docs-cli/blob/main/latest/docs-ref-autogen/role/assignment.yml)
* Service: **azure-resource-manager**
* GitHub Login: @rloutlaw
* Microsoft Alias: **routlaw**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.