Azure / Azure/azure-rest-api-specs
[BUG] Microsoft.Authorization/stable/2023-04-01/policyDefinitions.json $filter definition is incorrect
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 5.9k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 424
Description
### API Spec link
https://github.com/Azure/azure-rest-api-specs/blob/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2023-04-01/policyDefinitions.json#L700
### API Spec version
2023-04-01
### Describe the bug
REST API [documentation](https://learn.microsoft.com/en-us/rest/api/policy/policy-definitions/list?view=rest-policy-2023-04-01&tabs=HTTP) states following for $filter query parameter
> If $filter='category -eq {value}' is provided, the returned list only includes all policy definitions whose category match the {value}.
Let's filtering syntax available on the documentation
```powershell
$x = Invoke-AzRestMethod -Path "/subscriptions/${subscriptionId}/providers/Microsoft.Authorization/policyDefinitions?api-version=2023-04-01&`$filter='category -eq SQL'"
$x.StatusCode
# returns 404
```
Let's try other filtering syntax from other endpoints:
```powershell
$x = Invoke-AzRestMethod -Path "/subscriptions/${subscriptionId}/providers/Microsoft.Authorization/policyDefinitions?api-version=2023-04-01&`$filter=category eq 'SQL'"
$x.StatusCode
# returns 200
($x.Content | ConvertFrom-Json).value.Count
# returns 80 (policy definitions)
```
### Expected behavior
Documentation should be correct and if possible provide working examples.
### Actual behavior
$filter directive given is the documentation does not match with reality and at least filter by category does not work. Did not test other filter types
### Reproduction Steps
In the description
### Environment
N/A. Calling REST API directly.
Contributor guide
Assessment
This issue has not been assessed yet.