-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Role] BREAKING CHANGE: az role assignment create: --scope is now a required argument
#27651
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
Conversation
🔄AzureCLI-FullTest
|
❌AzureCLI-BreakingChangeTest
|
|
Role |
| if namespace.scope and resource_group and getattr(resource_group, 'is_default', None): | ||
| namespace.resource_group_name = None # drop configured defaults | ||
| # `az role assignment create` doesn't support resource_group_name | ||
| if hasattr(namespace, "resource_group_name"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can mention removing --resource-group in history notes. This is also a breaking change customers need to pay attention
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! Added to the History Notes section.
|
|
||
| for arg in non_empty_args: | ||
| if getattr(namespace, arg) == "": | ||
| if getattr(namespace, arg, None) == "": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason to add the default value for getattr, is there any difference between scope and other non_empty_args?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. After removing resource_group_name from az role assignment create, resource_group_name will not exist in namespace. If we don't add a default value here, getattr will fail for resource_group_name under az role assignment create.
Close #24753
Related command
az role assignment createDescription
To adhere to the Principle of Least Privilege and avoid over-scoped role assignment on the subscription,
--scopeis now a required argument.A warning for this breaking change was announced in #24755.
See #24753 for detailed explanation.
The corresponding change on
az vm/vmssis #27657.Testing Guide
az role assignment create --assignee-object-id xxx --scope /subscriptions/xxx/resourceGroups/xxx --role reader az role assignment create --assignee-object-id xxx --role reader # This fails: the following arguments are required: --scopeHistory Notes
[Role] BREAKING CHANGE:
az role assignment create:--scopeis now a required argument.[Role] BREAKING CHANGE:
az role assignment create: Remove--resource-groupargument.