-
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] BREAKING CHANGE: Fix #11883: az role assignment create
: empty scope will prompt error
#11983
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
7e9e1c6
[RBAC] BREAKING CHANGE: Fix #11883: `az role assignment create`: empt…
arrownj 456acef
add test for role assignment with empty scope case
arrownj b1ad459
udpate HISTORY.rst according to alphabetic order
arrownj 291404e
Merge branch 'dev' into fix/scope_empty
arrownj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
import mock | ||
import unittest | ||
|
||
from knack.util import CLIError | ||
from azure_devtools.scenario_tests import AllowLargeResponse, record_only | ||
from azure.cli.core.profiles import ResourceType, get_sdk | ||
from azure.cli.testsdk import ScenarioTest, LiveScenarioTest, ResourceGroupPreparer, KeyVaultPreparer | ||
|
@@ -295,6 +296,11 @@ def test_role_assignment_e2e(self, resource_group): | |
self.cmd('role assignment list --assignee {upn}', | ||
checks=self.check("length([])", 1)) | ||
self.cmd('role assignment delete --assignee {upn} --role reader') | ||
|
||
# test role assignment on empty scope | ||
with self.assertRaisesRegexp(CLIError, 'Invalid scope. Please use --help to view the valid format.'): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Usually we just use some phrases in the error message, like "Invalid scope", to have more flexibility of the error message in the future. But this is totally fine to be more strict on the error message. 😉 |
||
self.cmd('role assignment create --assignee {upn} --scope "" --role reader') | ||
self.cmd('role assignment delete --assignee {upn} --scope "" --role reader') | ||
finally: | ||
self.cmd('ad user delete --upn-or-object-id {upn}') | ||
|
||
|
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.
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.
Please place this entry in the right place in the history file following alphabetic order.
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.
Thanks, updated.