diff --git a/src/azure-cli/azure/cli/command_modules/acs/_validators.py b/src/azure-cli/azure/cli/command_modules/acs/_validators.py index 126cdd0433b..77a93943379 100644 --- a/src/azure-cli/azure/cli/command_modules/acs/_validators.py +++ b/src/azure-cli/azure/cli/command_modules/acs/_validators.py @@ -147,11 +147,11 @@ def validate_linux_host_name(namespace): in the CLI pre-flight. """ # https://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address - rfc1123_regex = re.compile(r'^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$') # pylint:disable=line-too-long + rfc1123_regex = re.compile(r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$') # pylint:disable=line-too-long found = rfc1123_regex.findall(namespace.name) if not found: - raise CLIError('--name cannot exceed 63 characters and can only contain ' - 'letters, numbers, or dashes (-).') + raise InvalidArgumentValueError('--name cannot exceed 63 characters and can only contain ' + 'letters, numbers, underscores (_) or dashes (-).') def validate_snapshot_name(namespace):