Azure / Azure/azure-rest-api-specs
[Role] `RoleAssignmentProperties.principalType` should not have default value `User`
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 5.9k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 444
Description
During Azure CLI's migration to `azure-mgmt-authorization` Track 2 SDK (https://github.com/Azure/azure-cli/issues/23372), this change is spotted.
In the previous API `2020-04-01-preview`, `RoleAssignmentProperties.principalType` has no default value:
https://github.com/Azure/azure-rest-api-specs/blob/b02ad2011daebdaa4ffc1b0b338181a464d49c47/specification/authorization/resource-manager/Microsoft.Authorization/preview/2020-04-01-preview/authorization-RoleAssignmentsCalls.json#L508-L527
In the latest API `2022-04-01`, it has a default value of `User`:
https://github.com/Azure/azure-rest-api-specs/blob/495363bc011ce917f579adc1a5209073565d37f4/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/authorization-RoleAssignmentsCalls.json#L574-L593
This breaks Azure CLI as we assume `principalType` is by default `None`:
https://github.com/Azure/azure-cli/blob/7232ac23b23c8b5b26a6cfd514600207bb79ebce/src/azure-cli/azure/cli/command_modules/role/_multi_api_adaptor.py#L50-L51
```py
if assignee_principal_type:
parameters.principal_type = assignee_principal_type
```
**There should be no assumption that `principalType` is a `User`.**
Contributor guide
Research direction
Compare the principalType definitions in specification/authorization/resource-manager/Microsoft.Authorization/preview/2020-04-01-preview/authorization-RoleAssignmentsCalls.json and stable/2022-04-01/authorization-RoleAssignmentsCalls.json. Read the referenced Azure CLI logic in src/azure-cli/azure/cli/command_modules/role/_multi_api_adaptor.py, then verify that the specification no longer supplies User as the default and that the CLI's omitted value remains None.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100