[Role] BREAKING CHANGE: az role assignment create: --scope is now a required argument#27651
Merged
[Role] BREAKING CHANGE: az role assignment create: --scope is now a required argument#27651
az role assignment create: --scope is now a required argument#27651Conversation
🔄AzureCLI-FullTest
|
❌AzureCLI-BreakingChangeTest
|
Collaborator
|
Role |
evelyn-ys
reviewed
Nov 2, 2023
| 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"): |
Member
There was a problem hiding this comment.
We can mention removing --resource-group in history notes. This is also a breaking change customers need to pay attention
Member
Author
There was a problem hiding this comment.
Nice catch! Added to the History Notes section.
evelyn-ys
approved these changes
Nov 2, 2023
bebound
reviewed
Nov 3, 2023
|
|
||
| for arg in non_empty_args: | ||
| if getattr(namespace, arg) == "": | ||
| if getattr(namespace, arg, None) == "": |
Contributor
There was a problem hiding this comment.
Is there any reason to add the default value for getattr, is there any difference between scope and other non_empty_args?
Member
Author
There was a problem hiding this comment.
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.
bebound
approved these changes
Nov 3, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.