-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[Role] Feature: Add az role deny-assignment create/delete commands
#33109
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
base: dev
Are you sure you want to change the base?
Changes from all commits
e1de2c3
f7381f3
99748f0
8f73679
845394a
96e99ff
f054a2c
df6627a
1995203
5e42534
e8e2d62
b6bbe6d
07b2efa
e1128da
ab9c055
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 | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -390,6 +390,60 @@ class PrincipalType(str, Enum): | |||||||
| with self.argument_context('role assignment delete') as c: | ||||||||
| c.argument('yes', options_list=['--yes', '-y'], action='store_true', help='Currently no-op.') | ||||||||
|
|
||||||||
| with self.argument_context('role deny-assignment') as c: | ||||||||
| c.argument('scope', help='Scope at which the deny assignment applies. ' | ||||||||
| 'For example, /subscriptions/00000000-0000-0000-0000-000000000000 or ' | ||||||||
| '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup') | ||||||||
| c.argument('deny_assignment_name', options_list=['--name', '-n'], | ||||||||
| help='The display name of the deny assignment.') | ||||||||
|
|
||||||||
| with self.argument_context('role deny-assignment list') as c: | ||||||||
| c.argument('filter_str', options_list=['--filter'], | ||||||||
| help='OData filter expression to apply. For example, ' | ||||||||
| '"atScope()" to list at the current scope, or ' | ||||||||
| '"gdprExportPrincipalId eq \'{objectId}\'" to list for a specific principal.') | ||||||||
|
|
||||||||
| with self.argument_context('role deny-assignment show') as c: | ||||||||
| c.argument('deny_assignment_id', options_list=['--id'], | ||||||||
| help='The fully qualified ID of the deny assignment including scope, ' | ||||||||
| 'e.g. /subscriptions/{id}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}') | ||||||||
| c.argument('deny_assignment_name', options_list=['--name', '-n'], | ||||||||
| help='The name (GUID) of the deny assignment.') | ||||||||
|
|
||||||||
| with self.argument_context('role deny-assignment create') as c: | ||||||||
| c.argument('deny_assignment_name', options_list=['--name', '-n'], | ||||||||
| help='The display name of the deny assignment.') | ||||||||
| c.argument('description', help='Description of the deny assignment.') | ||||||||
| c.argument('actions', nargs='+', | ||||||||
| help='Space-separated list of actions to deny, e.g. ' | ||||||||
| '"Microsoft.Authorization/roleAssignments/write". ' | ||||||||
| 'Note: read actions (*/read) are not permitted for user-assigned deny assignments.') | ||||||||
| c.argument('not_actions', nargs='+', | ||||||||
| help='Space-separated list of actions to exclude from the deny.') | ||||||||
| c.argument('principal_id', options_list=['--principal-object-id'], | ||||||||
| help='The object ID of a specific User or ServicePrincipal to deny. ' | ||||||||
| 'If omitted, the deny assignment applies to Everyone (all principals) and ' | ||||||||
| '--exclude-principal-ids is required. Group principals are not permitted.') | ||||||||
| c.argument('principal_type', options_list=['--principal-type'], | ||||||||
| arg_type=get_enum_type(['User', 'ServicePrincipal']), | ||||||||
| help='The type of the principal specified by --principal-object-id. ' | ||||||||
| 'Required when --principal-object-id is provided. Accepted values: User, ServicePrincipal.') | ||||||||
| c.argument('exclude_principal_ids', nargs='+', options_list=['--exclude-principal-ids'], | ||||||||
| help='Space-separated list of principal object IDs to exclude from the deny. ' | ||||||||
| 'Required when no --principal-object-id is specified (Everyone mode). ' | ||||||||
| 'Optional when --principal-object-id is specified.') | ||||||||
| c.argument('exclude_principal_types', nargs='+', options_list=['--exclude-principal-types'], | ||||||||
|
||||||||
| c.argument('exclude_principal_types', nargs='+', options_list=['--exclude-principal-types'], | |
| c.argument('exclude_principal_types', nargs='+', options_list=['--exclude-principal-types'], | |
| arg_type=get_enum_type(['User', 'Group', 'ServicePrincipal']), |
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.
deny_assignment_nameis defined at therole deny-assignmentgroup level, which makes--name/-nshow up for subcommands likelisteven thoughlist_deny_assignmentsdoesn't accept that parameter. If a user supplies--nameonlist, the handler will receive an unexpected kwarg and fail. Recommend removingdeny_assignment_namefrom the group context and defining--nameonly onshow/create/deletewhere it is supported.