Skip to content

Commit

Permalink
{AMS} Migrate AMS module to new Microsoft graph (#22703)
Browse files Browse the repository at this point in the history
  • Loading branch information
hivyas authored Jun 28, 2022
1 parent 5025de4 commit 8058c09
Show file tree
Hide file tree
Showing 5 changed files with 988 additions and 692 deletions.
11 changes: 2 additions & 9 deletions src/azure-cli/azure/cli/command_modules/ams/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,8 @@ def _auth_client_factory(cli_ctx, scope=None):


def _graph_client_factory(cli_ctx, **_):
from azure.cli.core._profile import Profile
from azure.cli.core.commands.client_factory import configure_common_settings
from azure.graphrbac import GraphRbacManagementClient
profile = Profile(cli_ctx=cli_ctx)
cred, _, tenant_id = profile.get_login_credentials(
resource=cli_ctx.cloud.endpoints.active_directory_graph_resource_id)
client = GraphRbacManagementClient(cred, tenant_id,
base_url=cli_ctx.cloud.endpoints.active_directory_graph_resource_id)
configure_common_settings(cli_ctx, client)
from azure.cli.command_modules.role import graph_client_factory
client = graph_client_factory(cli_ctx)
return client


Expand Down
10 changes: 6 additions & 4 deletions src/azure-cli/azure/cli/command_modules/ams/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,14 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
c.argument('account_name', account_name_arg_type)
c.argument('sp_name', name_arg_type,
help="The app name or app URI to associate the RBAC with. If not present, a default name like '{amsaccountname}-access-sp' will be generated.")
c.argument('new_sp_name', help="The new app name or app URI to update the RBAC with.")
c.argument('sp_password', password_arg_type,
help="The password used to log in. Also known as 'Client Secret'. If not present, a random secret will be generated.")
c.argument('role', help='The role of the service principal.', completer=get_role_definition_name_completion_list)
c.argument('password_display_name', password_arg_type,
help="The friendly name of the password. The actual password will be an autogenerated strong password which will be displayed after the command runs.")
c.argument('years', help='Number of years for which the secret will be valid. Default: 1 year.', type=int)
c.argument('xml', action='store_true', help='Enables xml output format.')
c.argument('years', help='Number of years for which the secret will be valid. Default: 1 year.', type=int, default=None)

with self.argument_context('ams account sp create') as c:
c.argument('new_sp_name', help="The new app name or app URI to update the RBAC with.")

with self.argument_context('ams account encryption') as c:
c.argument('account_name', account_name_arg_type)
Expand Down
Loading

0 comments on commit 8058c09

Please sign in to comment.