Azure / Azure/azure-rest-api-specs
Add Filter for NewListForScopePager on RoleManagementPolicyAssignmentsClient
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 5.9k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 444
Description
### Feature Request
I am creating a Terraform resource to manage RoleManagementPolicies through terraform. I am looking to use the RoleManagementPoliciesClient to list role management policies for a given `scope` and `roleDefinitionId` to then load the existing RoleManagementPolicy. However, the `NewListForScopePager` does not allow specifying a `Filter`.
There is `Filter` support on other List methods and you are able to filter directly on the REST method (see: https://docs.microsoft.com/en-us/rest/api/authorization/privileged-role-policy-rest-sample)
`https://management.azure.com/providers/Microsoft.Subscription/subscriptions/{{subscription-id}}/providers/Microsoft.Authorization/roleManagementPolicies?api-version=2020-10-01-preview&filter=roleDefinitionId eq '/subscriptions/********-****-****-****-************/providers/Microsoft.Authorization/roleDefinitions/********-****-****-****-************'`
This will return you the roleManagementPolicy for the request subscription and role.
Could support for `Filter` be added to this method?
EDIT
----
I had originally quoted the above API call which is incorrect, the correct call is to retreive a RoleManagementPolicyAssignment for a scope/roleDefinitionId, this can be acheived with the following API call
`https://management.azure.com/subscriptions/{{subscription-id}}/providers/Microsoft.Authorization/roleManagementPolicyAssignments?api-version=2020-10-01&$filter=roleDefinitionId eq '/subscriptions/********-****-****-****-************/providers/Microsoft.Authorization/roleDefinitions/********-****-****-****-************'`
So this applies to the `RoleManagementPolicyAssignmentsClient` and would request the addition of the `Filter` property.
Have tested in Postman with the above query and it does return the result for the scope/roleDefinitionId combination.
Contributor guide
Research direction
Start by locating the RoleManagementPolicyAssignmentsClient.NewListForScopePager definition and its corresponding REST API specification. Check how the list operation represents the $filter query parameter, then verify that the generated request supports filtering by roleDefinitionId as shown in the issue's REST URL.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi
- Domain
- api, cloud
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100