Skip to content

Commit

Permalink
role-definition-show
Browse files Browse the repository at this point in the history
  • Loading branch information
jiasli committed Dec 30, 2024
1 parent a8d8f05 commit d49dd06
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/azure-cli/azure/cli/command_modules/role/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,14 @@
short-summary: List role definitions.
"""

helps['role definition show'] = """
type: command
short-summary: Show a role definition.
examples:
- name: Show the 'Reader' role definition.
text: az role definition show --scope /subscriptions/00000000-0000-0000-0000-000000000000 --name acdd72a7-3385-48ef-bd42-f606fba81ae7
"""

helps['role definition update'] = """
type: command
short-summary: Update a role definition.
Expand Down
1 change: 1 addition & 0 deletions src/azure-cli/azure/cli/command_modules/role/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def load_command_table(self, _):
g.custom_command('delete', 'delete_role_definition')
g.custom_command('create', 'create_role_definition')
g.custom_command('update', 'update_role_definition')
g.custom_command('show', 'show_role_definition')

with self.command_group('role assignment') as g:
g.custom_command('delete', 'delete_role_assignments', validator=process_assignment_namespace)
Expand Down
5 changes: 5 additions & 0 deletions src/azure-cli/azure/cli/command_modules/role/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ def list_role_definitions(cmd, name=None, resource_group_name=None, scope=None,
return _search_role_definitions(cmd.cli_ctx, definitions_client, name, [scope], custom_role_only)


def show_role_definition(cmd, scope, name):
definitions_client = _auth_client_factory(cmd.cli_ctx, scope).role_definitions
return definitions_client.get(scope, name)


def create_role_definition(cmd, role_definition):
return _create_update_role_definition(cmd, role_definition, for_update=False)

Expand Down

0 comments on commit d49dd06

Please sign in to comment.