From cbb1b391927bfba5bc964dc6104dae3fee1d923f Mon Sep 17 00:00:00 2001 From: Calvin Chan Date: Thu, 24 Mar 2022 14:24:02 -0700 Subject: [PATCH] Remove managed-identity support for first release of CLI --- src/containerapp/azext_containerapp/_help.py | 39 ------------------- .../azext_containerapp/_params.py | 7 ---- .../azext_containerapp/commands.py | 5 --- src/containerapp/azext_containerapp/custom.py | 29 +------------- 4 files changed, 1 insertion(+), 79 deletions(-) diff --git a/src/containerapp/azext_containerapp/_help.py b/src/containerapp/azext_containerapp/_help.py index dde874e3e55..baf70ae24b0 100644 --- a/src/containerapp/azext_containerapp/_help.py +++ b/src/containerapp/azext_containerapp/_help.py @@ -264,45 +264,6 @@ az containerapp env dapr-component remove -g MyResourceGroup --dapr-component-name MyDaprComponentName --name MyEnvironment """ -# Identity Commands -helps['containerapp identity'] = """ - type: group - short-summary: Commands to manage managed identities. -""" - -helps['containerapp identity assign'] = """ - type: command - short-summary: Assign managed identity to a container app. - long-summary: Managed identities can be user-assigned or system-assigned. - examples: - - name: Assign system identity. - text: | - az containerapp identity assign - - name: Assign user identity. - text: | - az containerapp identity assign --identities myAssignedId - - name: Assign system and user identity. - text: | - az containerapp identity assign --identities [system] myAssignedId -""" - -helps['containerapp identity remove'] = """ - type: command - short-summary: Remove a managed identity from a container app. - examples: - - name: Remove system identity. - text: | - az containerapp identity remove --identities [system] - - name: Remove system and user identity. - text: | - az containerapp identity remove --identities [system] myAssignedId -""" - -helps['containerapp identity show'] = """ - type: command - short-summary: Show managed identities of a container app. -""" - # Ingress Commands helps['containerapp ingress'] = """ type: group diff --git a/src/containerapp/azext_containerapp/_params.py b/src/containerapp/azext_containerapp/_params.py index c70de7f12ac..6e0ee6918d4 100644 --- a/src/containerapp/azext_containerapp/_params.py +++ b/src/containerapp/azext_containerapp/_params.py @@ -75,7 +75,6 @@ def load_arguments(self, _): c.argument('transport', arg_type=get_enum_type(['auto', 'http', 'http2']), help="The transport protocol used for ingress traffic.") with self.argument_context('containerapp create') as c: - c.argument('assign_identity', nargs='+', help="Space-separated identities. Use '[system]' to refer to the system assigned identity.") c.argument('traffic_weights', nargs='*', options_list=['--traffic-weight'], help="A list of revision weight(s) for the container app. Space-separated values in 'revision_name=weight' format. For latest revision, use 'latest=weight'") with self.argument_context('containerapp scale') as c: @@ -113,12 +112,6 @@ def load_arguments(self, _): with self.argument_context('containerapp env show') as c: c.argument('name', name_type, help='Name of the Container Apps Environment.') - with self.argument_context('containerapp identity') as c: - c.argument('identities', nargs='+', help="Space-separated identities. Use '[system]' to refer to the system assigned identity.") - - with self.argument_context('containerapp identity assign') as c: - c.argument('identities', nargs='+', help="Space-separated identities. Use '[system]' to refer to the system assigned identity. Default is '[system]'.") - with self.argument_context('containerapp github-action add') as c: c.argument('repo_url', help='The GitHub repository to which the workflow file will be added. In the format: https://github.com//') c.argument('token', help='A Personal Access Token with write access to the specified repository. For more information: https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line') diff --git a/src/containerapp/azext_containerapp/commands.py b/src/containerapp/azext_containerapp/commands.py index dd6f2d067dc..c5b924287f8 100644 --- a/src/containerapp/azext_containerapp/commands.py +++ b/src/containerapp/azext_containerapp/commands.py @@ -62,11 +62,6 @@ def load_command_table(self, _): g.custom_command('set', 'create_or_update_dapr_component') g.custom_command('remove', 'remove_dapr_component') - with self.command_group('containerapp identity') as g: - g.custom_command('assign', 'assign_managed_identity', supports_no_wait=True, exception_handler=ex_handler_factory()) - g.custom_command('remove', 'remove_managed_identity', supports_no_wait=True, exception_handler=ex_handler_factory()) - g.custom_show_command('show', 'show_managed_identity') - with self.command_group('containerapp github-action') as g: g.custom_command('add', 'create_or_update_github_action', exception_handler=ex_handler_factory()) g.custom_show_command('show', 'show_github_action', exception_handler=ex_handler_factory()) diff --git a/src/containerapp/azext_containerapp/custom.py b/src/containerapp/azext_containerapp/custom.py index 1f49d3c9302..15cea81f0ff 100644 --- a/src/containerapp/azext_containerapp/custom.py +++ b/src/containerapp/azext_containerapp/custom.py @@ -292,8 +292,7 @@ def create_containerapp(cmd, startup_command=None, args=None, tags=None, - no_wait=False, - assign_identity=None): + no_wait=False): _validate_subscription_registered(cmd, "Microsoft.App") if yaml: @@ -310,9 +309,6 @@ def create_containerapp(cmd, if managed_env is None: raise RequiredArgumentMissingError('Usage error: --environment is required if not using --yaml') - if assign_identity is None: - assign_identity = [] - # Validate managed environment parsed_managed_env = parse_resource_id(managed_env) managed_env_name = parsed_managed_env['name'] @@ -378,28 +374,6 @@ def create_containerapp(cmd, config_def["registries"] = [registries_def] if registries_def is not None else None config_def["dapr"] = dapr_def - # Identity actions - identity_def = ManagedServiceIdentityModel - identity_def["type"] = "None" - - assign_system_identity = '[system]' in assign_identity - assign_user_identities = [x for x in assign_identity if x != '[system]'] - - if assign_system_identity and assign_user_identities: - identity_def["type"] = "SystemAssigned, UserAssigned" - elif assign_system_identity: - identity_def["type"] = "SystemAssigned" - elif assign_user_identities: - identity_def["type"] = "UserAssigned" - - if assign_user_identities: - identity_def["userAssignedIdentities"] = {} - subscription_id = get_subscription_id(cmd.cli_ctx) - - for r in assign_user_identities: - r = _ensure_identity_resource_id(subscription_id, resource_group_name, r) - identity_def["userAssignedIdentities"][r] = {} # pylint: disable=unsupported-assignment-operation - scale_def = None if min_replicas is not None or max_replicas is not None: scale_def = ScaleModel @@ -433,7 +407,6 @@ def create_containerapp(cmd, containerapp_def = ContainerAppModel containerapp_def["location"] = location - containerapp_def["identity"] = identity_def containerapp_def["properties"]["managedEnvironmentId"] = managed_env containerapp_def["properties"]["configuration"] = config_def containerapp_def["properties"]["template"] = template_def