Azure / Azure/azure-cli

`az role definition list` cannot show only built-in roles

Open
#30,647 2 comments 0 reactions 1 assignee Claimed by @jiasli View on GitHub
act-identity-squad Auto-Assign Azure CLI Team question RBAC
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

**Related command**
`az role definition list`

**Is your feature request related to a problem? Please describe.**
According to https://learn.microsoft.com/en-us/azure/role-based-access-control/role-definitions-list#list-role-definitions, the underlying [Role Definitions - List](https://learn.microsoft.com/en-us/rest/api/authorization/role-definitions/list) REST API supports returning

1. `CustomRole` + `BuiltInRole`
2. only `CustomRole`
3. only `BuiltInRole`

But in CLI, `--custom-role-only` only supports returning

1. `CustomRole` + `BuiltInRole`
2. only `CustomRole`

https://github.com/Azure/azure-cli/blob/649886e71f5840b6d9dc3a53542cfc3f68d15876/src/azure-cli/azure/cli/command_modules/role/custom.py#L166-L167

thus losing the ability to only show `BuiltInRole`.

**Describe the solution you'd like**
`az role definition list` should support a `--type` argument that maps to the `$filter=type+eq+'{type}'` filter.

**Describe alternatives you've considered**

**Additional context**

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.