diff --git a/src/azure-cli/azure/cli/command_modules/batch/_validators.py b/src/azure-cli/azure/cli/command_modules/batch/_validators.py index c6a8661133f..f9d2c35cfa8 100644 --- a/src/azure-cli/azure/cli/command_modules/batch/_validators.py +++ b/src/azure-cli/azure/cli/command_modules/batch/_validators.py @@ -304,10 +304,10 @@ def validate_client_parameters(cmd, namespace): namespace.account_endpoint = cmd.cli_ctx.config.get('batch', 'endpoint', None) # Simple validation for account_endpoint - if not (namespace.account_endpoint.startswith('https://') or - namespace.account_endpoint.startswith('http://')): + if namespace.account_endpoint and not (namespace.account_endpoint.startswith('https://') or + namespace.account_endpoint.startswith('http://')): namespace.account_endpoint = 'https://' + namespace.account_endpoint - namespace.account_endpoint = namespace.account_endpoint.rstrip('/') + namespace.account_endpoint = namespace.account_endpoint.rstrip('/') # if account name is specified but no key, attempt to query if we use shared key auth if namespace.account_name and namespace.account_endpoint and not namespace.account_key: if cmd.cli_ctx.config.get('batch', 'auth_mode', 'shared_key') == 'shared_key':