az policy exemption create - (InvalidResourceType) The resource type 'policyAssignments' could not be found in the namespace 'Microsoft.Authorization' for api version '2020-07-01-preview'
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
## Describe the bug
Similar to this one #22684
When trying to create an exemption via the az cli, I get an error, that the api-version is not supported.
**Command Name**
`az policy exemption create`
**Errors:**
```
(InvalidResourceType) The resource type 'policyAssignments' could not be found in the namespace 'Microsoft.Authorization' for api version '2020-07-01-preview'. The supported api-versions are '2015-10-01-preview,2016-04-01,2016-12-01,2017-06-01-preview,2018-03-01,2018-05-01,2019-01-01,2019-06-01,2019-09-01,2020-03-01,2020-08-01,2020-09-01,2021-06-01,2022-06-01'.
Code: InvalidResourceType
Message: The resource type 'policyAssignments' could not be found in the namespace 'Microsoft.Authorization' for api version '2020-07-01-preview'. The supported api-versions are '2015-10-01-preview,2016-04-01,2016-12-01,2017-06-01-preview,2018-03-01,2018-05-01,2019-01-01,2019-06-01,2019-09-01,2020-03-01,2020-08-01,2020-09-01,2021-06-01,2022-06-01'.
```
## To Reproduce:
- Fill in the respective variables
- Run the following command:
`az policy exemption create --name "$ResourceGroup Exemption - $AssignmentId" --scope /subscriptions/$SubscriptionId/resourceGroups/$ResourceGroup --display-name "$DisplayName" --policy-assignment $AssignmentId --exemption-category "Mitigated" --description "Some description"`
> $AssignmentId is in the format /subscriptions/$SubscriptionId/providers/Microsoft.Authorization/policyAssignments/$PolicyId
## Expected Behavior
Exemption is created without error
## Environment Summary
```
Windows-10-10.0.19044-SP0,
Python 3.10.10
Installer: MSI
azure-cli 2.49.0
Extensions:
account 0.2.5
aks-preview 0.5.113
azure-devops 0.25.0
azure-firewall 0.14.5
spring 1.6.5
Dependencies:
msal 1.20.0
azure-mgmt-resource 22.0.0
```
## Additional Context
I also tried the command with the --resource-group parameter instead of the scope, like in the bug mentioned above, but I get the same error regarding the api version
Contributor guide
Assessment
This issue has not been assessed yet.