diff --git a/src/containerapp/azext_containerapp/_params.py b/src/containerapp/azext_containerapp/_params.py index b2d778e08ae..6ed1709f19e 100644 --- a/src/containerapp/azext_containerapp/_params.py +++ b/src/containerapp/azext_containerapp/_params.py @@ -75,9 +75,12 @@ 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 create', arg_group='Identity') as c: + c.argument('user_assigned', nargs='+', help="Space-separated user identities to be assigned.") + c.argument('system_assigned', help="Boolean indicating whether to assign system-assigned identity.") + with self.argument_context('containerapp scale') as c: c.argument('min_replicas', type=int, help="The minimum number of replicas.") c.argument('max_replicas', type=int, help="The maximum number of replicas.") @@ -115,7 +118,7 @@ def load_arguments(self, _): with self.argument_context('containerapp identity') as c: c.argument('user_assigned', nargs='+', help="Space-separated user identities.") - c.argument('system_assigned', help="System-assigned identity.") + c.argument('system_assigned', help="Boolean indicating whether to assign system-assigned identity.") with self.argument_context('containerapp identity remove') as c: c.argument('user_assigned', nargs='*', help="Space-separated user identities. If no user identities are specified, all user identities will be removed.") diff --git a/src/containerapp/azext_containerapp/custom.py b/src/containerapp/azext_containerapp/custom.py index c09a4d1b395..06ce16ad26d 100644 --- a/src/containerapp/azext_containerapp/custom.py +++ b/src/containerapp/azext_containerapp/custom.py @@ -293,7 +293,8 @@ def create_containerapp(cmd, args=None, tags=None, no_wait=False, - assign_identity=None): + system_assigned=False, + user_assigned=None): _validate_subscription_registered(cmd, "Microsoft.App") if yaml: @@ -310,9 +311,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'] @@ -382,8 +380,11 @@ def create_containerapp(cmd, 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]'] + assign_system_identity = system_assigned + if user_assigned: + assign_user_identities = [x.lower() for x in user_assigned] + else: + assign_user_identities = [] if assign_system_identity and assign_user_identities: identity_def["type"] = "SystemAssigned, UserAssigned"