diff --git a/src/azure-cli-core/azure/cli/core/commands/template_create.py b/src/azure-cli-core/azure/cli/core/commands/template_create.py index d9733d4f64e..6834b175e00 100644 --- a/src/azure-cli-core/azure/cli/core/commands/template_create.py +++ b/src/azure-cli-core/azure/cli/core/commands/template_create.py @@ -16,7 +16,7 @@ def get_folded_parameter_help_string( display_name, allow_none=False, allow_new=False, default_none=False, - other_required_option=None): + other_required_option=None, allow_cross_sub=True): """ Assembles a parameterized help string for folded parameters. """ quotes = '""' if platform.system() == 'Windows' else "''" @@ -43,9 +43,11 @@ def get_folded_parameter_help_string( # add parent name option string (if applicable) if other_required_option: help_text = '{} If name specified, also specify {}.'.format(help_text, other_required_option) - help_text = '{} If you want to use an existing {display_name} in other resource group or subscription, ' \ + extra_sub_text = " or subscription" if allow_cross_sub else "" + help_text = '{} If you want to use an existing {display_name} in other resource group{append_sub}, ' \ 'please provide the ID instead of the name of the {display_name}'.format(help_text, - display_name=display_name) + display_name=display_name, + append_sub=extra_sub_text) return help_text diff --git a/src/azure-cli/azure/cli/command_modules/network/_params.py b/src/azure-cli/azure/cli/command_modules/network/_params.py index b55106852f2..13585e0434a 100644 --- a/src/azure-cli/azure/cli/command_modules/network/_params.py +++ b/src/azure-cli/azure/cli/command_modules/network/_params.py @@ -938,7 +938,7 @@ def load_arguments(self, _): nsg_help = get_folded_parameter_help_string('network security group', allow_none=True, default_none=True) c.argument('network_security_group', help=nsg_help, completer=get_resource_name_completion_list('Microsoft.Network/networkSecurityGroups')) - subnet_help = get_folded_parameter_help_string('subnet', other_required_option='--vnet-name') + subnet_help = get_folded_parameter_help_string('subnet', other_required_option='--vnet-name', allow_cross_sub=False) c.argument('subnet', help=subnet_help, completer=subnet_completion_list) with self.argument_context('network nic update') as c: