Azure / azure-rest-api-specs-examples

SDK examples for azure-rest-api-specs
MIT License
22 stars 13 forks source link

Unable to GET Role Definition by Role Name #2192

Open abernalmac opened 1 year ago

abernalmac commented 1 year ago

Link to sample

https://learn.microsoft.com/en-us/rest/api/authorization/role-definitions

Library name and version

github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization

Language of the Sample

Sample Issue Type

Issue details

Using the Azure CLI it is possible to obtain a role by its name like this: az role definition list --name MyRoleName Using the API (or any SDK, since these use the API) I am only able to get roles by ID. IDs are non-user-friendly Azure generated UUIDs.

Expected behavior

API documentation for Get states that it "Gets a role definition by name", while GetByID "Gets a role definition by ID".

Actual behavior

Both get the role by ID.

Reproduction Steps

GET https://management.azure.com/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}?api-version=2022-04-01

GET https://management.azure.com/roleDefinitionId?disambiguation_dummy&api-version=2022-04-01

Environment

Any

weidongxu-microsoft commented 1 year ago

You can use --debug on Azure CLI to see what it calls.

CLI usually provide easy-to-use feature, while SDK usually only provide REST API.