Azure / Azure/azure-powershell
Get-AzRoleAssignmentScheduleInstance needs to support -Filter on all parametersets
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 51
Description
### Description
It is currently not possible to use `Get-AzRoleAssignmentScheduleInstance` to fetch an individual instance without a privilege error for an unprivileged user unless `filter=asTarget()` is also specified, but there is no combination of parameter sets that allow this, `-Filter` is only allowed with a "naked" call and the scope parameter.
## Workaround
```ps
invoke-azrestmethod 'https://management.azure.com///providers/Microsoft.Authorization/roleAssignmentScheduleInstances/257498e2-xxxx-xxxx-xxxx-daaaee9025b3?$filter=asTarget%28%29&api-version=2020-10-01'`
```
### Issue script & Debug output
```PowerShell
N/A
```
### Environment data
```PowerShell
Name Value
---- -----
PSVersion 7.2.3
PSEdition Core
GitCommitId 7.2.3
OS Microsoft Windows 10.0.22610
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```
### Module versions
```PowerShell
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.7.6 Az.Accounts {Add-AzEnvironment, Clear-AzContext, Clear-AzDefault, Connect-AzAccount…}
Script 5.6.0 Az.Resources {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-AzDeployment…}
```
### Error output
_No response_
Contributor guide
Research direction
Start at the Get-AzRoleAssignmentScheduleInstance cmdlet and inspect how its parameter sets expose -Filter, then compare that behavior with the roleAssignmentScheduleInstances REST endpoint and its filter=asTarget() workaround. Done means the cmdlet accepts -Filter with the individual-instance parameter combinations and avoids the reported privilege error; add or update the relevant tests if the repository identifies them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp, powershell
- Domain
- authorization, cli, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100