-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RBAC commands not using Python SDK models correctly #26362
Comments
Thank you for opening this issue, we will look into it. |
just for reference: Azure/azure-sdk-for-python#30256 (comment) |
I am able to repo by running following commands:
The difference in SDK models from different API versions comes from different In 2015-07-01, "RoleAssignmentCreateParameters": {
"properties": {
"properties": {
"$ref": "#/definitions/RoleAssignmentProperties",
"description": "Role assignment properties."
}
}, But in 2022-04-01, "RoleAssignmentCreateParameters": {
"properties": {
"properties": {
"x-ms-client-flatten": true,
"$ref": "#/definitions/RoleAssignmentProperties",
"description": "Role assignment properties."
}
}, Considering following calling pattern:
In Track 1 SDK, def create(
self, scope, role_assignment_name, properties, custom_headers=None, raw=False, **operation_config):
:param properties: Role assignment properties.
:type properties:
~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentProperties However, in Track 2 SDK and newer API versions, def create(
self,
scope: str,
role_assignment_name: str,
parameters: Union[_models.RoleAssignmentCreateParameters, IO],
**kwargs: Any
) -> _models.RoleAssignment: This is due to a behavior change in very old versions of code-gen: If This breaking change in We explicitly called out in our public doc that the latest
|
Command Name
az role assignment create
Describe the bug
This issue is related to this one I filed for azure-sdk-for-python:
Azure/azure-sdk-for-python#30256
This comment from Azure Python SDK team says Azure CLI is not using Python SDK model correctly for
az role assignment create
commands (and possibly other commands, but I am only aware of this command currently):Azure/azure-sdk-for-python#30256 (comment)
For example, in the following code:
azure-cli/src/azure-cli/azure/cli/command_modules/role/_multi_api_adaptor.py
Line 53 in 57b3fe1
Python Azure SDK team from the above linked comment says the call for
RoleAssignmentCreateParameters
for an old API such as 2015-07-01 should look like the following instead:For reference, this is the
ResourceType.MGMT_AUTHORIZATION
SDK profile currently in the Azure CLI code:azure-cli/src/azure-cli-core/azure/cli/core/profiles/_shared.py
Line 287 in 57b3fe1
The Microsoft.Authorization 2015-07-01 API version contract:
https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01
Note that this issue was discovered on Azure Stack Hub AAD environment. I tested the same commands on an ADFS environment and did not run into this issue, so there are likely diverging code flows between AAD and ADFS environments for the commands related to this issue.
Errors:
To Reproduce
Example step to reproduce one of the issues:
az role assignment create
command.Expected behavior
Should not throw an error.
Environment summary
The text was updated successfully, but these errors were encountered: