-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Role] az ad sp create-for-rbac: Deprecate creating Contributor role assignment by default #16081
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
Changes from 4 commits
f27078e
9040722
c15ae85
93e36a9
cf1606b
a803c62
fa68140
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,11 @@ | |
| "The output includes credentials that you must protect. Be sure that you do not include these credentials in " | ||
| "your code or check the credentials into your source control. For more information, see https://aka.ms/azadsp-cli") | ||
|
|
||
| ROLE_ASSIGNMENT_CREATE_WARNING = ( | ||
| "In a future release, this command will NOT create any role assignment by default. (--skip-assignment will be the " | ||
| "default behavior.) If needed, always use --role to explicitly create a role assignment." | ||
| ) | ||
|
|
||
| logger = get_logger(__name__) | ||
|
|
||
| # pylint: disable=too-many-lines | ||
|
|
@@ -1401,7 +1406,7 @@ def _validate_app_dates(app_start_date, app_end_date, cert_start_date, cert_end_ | |
| # pylint: disable=inconsistent-return-statements | ||
| def create_service_principal_for_rbac( | ||
| # pylint:disable=too-many-statements,too-many-locals, too-many-branches | ||
| cmd, name=None, years=None, create_cert=False, cert=None, scopes=None, role='Contributor', | ||
| cmd, name=None, years=None, create_cert=False, cert=None, scopes=None, role=None, | ||
|
Member
Author
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. Need to detect whether If
Member
Author
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. Another option is to check |
||
| show_auth_for_sdk=None, skip_assignment=False, keyvault=None): | ||
| import time | ||
|
|
||
|
|
@@ -1483,8 +1488,11 @@ def create_service_principal_for_rbac( | |
|
|
||
| # retry while server replication is done | ||
| if not skip_assignment: | ||
| if not role: | ||
| role = "Contributor" | ||
| logger.warning(ROLE_ASSIGNMENT_CREATE_WARNING) | ||
| for scope in scopes: | ||
| logger.warning('Creating a role assignment under the scope of "%s"', scope) | ||
| logger.warning("Creating '%s' role assignment under scope '%s'", role, scope) | ||
|
Member
Author
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. Echo the role name to be more explicit and informative. |
||
| for retry_time in range(0, _RETRY_TIMES): | ||
| try: | ||
| _create_role_assignment(cmd.cli_ctx, role, sp_oid, None, scope, resolve_assignee=False) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.