Open bebound opened 1 year ago
Find similar issue https://github.com/wangzelin007/github-bot-tutorial/issues/150. | ||
---|---|---|
Issue title | RBAC commands not using Python SDK models correctly | |
Create time | 2023-05-08 | |
Comment number | 0 |
Hi @bebound Find similar issue https://github.com/wangzelin007/github-bot-tutorial/issues/150. | ||
---|---|---|
Issue title | RBAC commands not using Python SDK models correctly | |
Create time | 2023-05-08 | |
Comment number | 0 |
Please confirm if this resolves your issue. Kindly react a 👍 or 👎 to this comment so that we can improve this robot.
Hi @bebound Find similar issue https://github.com/wangzelin007/github-bot-tutorial/issues/150. | ||
---|---|---|
Issue title | RBAC commands not using Python SDK models correctly | |
Create time | 2023-05-08 | |
Comment number | 0 |
Please confirm if this resolves your issue.
Command Name
az role assignment create
Describe the bug This issue is related to this one I filed for azure-sdk-for-python: https://github.com/Azure/azure-sdk-for-python/issues/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): https://github.com/Azure/azure-sdk-for-python/issues/30256#issuecomment-1537036568For example, in the following code: https://github.com/Azure/azure-cli/blob/57b3fe1f115e4a32a4ef0c6bbf2c31e3d0588a33/src/azure-cli/azure/cli/command_modules/role/_multi_api_adaptor.py#L53
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: https://github.com/Azure/azure-cli/blob/57b3fe1f115e4a32a4ef0c6bbf2c31e3d0588a33/src/azure-cli-core/azure/cli/core/profiles/_shared.py#L287The 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:
Register Azure CLI cloud against 2020-09-01-hybrid profile. PowerShell example:
Set Azure CLI cloud to the profile registered in step 1 and log in.
Run an
az role assignment create
command.Expected behavior Should not throw an error.
Environment summary
1