Skip to content

Use roleName filter to limit the results returned by az role definition list --name #30579

@kewalaka

Description

@kewalaka

Related command

Any role definition list operation that filters by name, e.g.:

az role definition list --name "Contributor"

Is your feature request related to a problem? Please describe.

The call to the resource manager API fetches all the IDs:

GET https://management.azure.com/subscriptions/<id>/providers/Microsoft.Authorization/roleDefinitions?api-version=2022-05-01-preview 
HTTP/1.1

Whilst the works, it seems unnecessarily costly given a specific name has been supplied.

Describe the solution you'd like

Consider specifying the role name if supplied, using the target query parameter:

GET https://management.azure.com/subscriptions/<id>/providers/Microsoft.Authorization/roleDefinitions?api-version=2022-05-01-preview&$filter=roleName%20eq%20'Contributor' 
HTTP/1.1

Describe alternatives you've considered
n/a

Additional context
https://learn.microsoft.com/en-us/rest/api/authorization/role-definitions/list?view=rest-authorization-2022-04-01&tabs=HTTP#uri-parameters

Metadata

Metadata

Assignees

Labels

Auto-AssignAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamRBACaz rolecustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions