diff --git a/README.md b/README.md
index beaabdc..727ae51 100644
--- a/README.md
+++ b/README.md
@@ -108,6 +108,10 @@ For advanced users, a hidden option `--logConfig <filename.ini>` can be used to
 
 # Release History
 
+## Not released yet
+
+* Add `--environment` internal parameter for `authorize-account`
+
 ## 2.0.0 (2020-06-25)
 
 Changes:
diff --git a/b2/console_tool.py b/b2/console_tool.py
index 2914a16..867a205 100644
--- a/b2/console_tool.py
+++ b/b2/console_tool.py
@@ -283,21 +283,20 @@ class AuthorizeAccount(Command):
 
     @classmethod
     def _setup_parser(cls, parser):
-        parser.add_argument('--dev', action='store_true', help=argparse.SUPPRESS)
-        parser.add_argument('--staging', action='store_true', help=argparse.SUPPRESS)
+        realm_group = parser.add_mutually_exclusive_group()
+        realm_group.add_argument('--dev', action='store_true', help=argparse.SUPPRESS)
+        realm_group.add_argument('--staging', action='store_true', help=argparse.SUPPRESS)
+        realm_group.add_argument('--environment', help=argparse.SUPPRESS)
+
         parser.add_argument('applicationKeyId', nargs='?')
         parser.add_argument('applicationKey', nargs='?')
 
     def run(self, args):
-        # Handle internal options for testing inside Backblaze.  These
-        # are not documented in the usage string.
-        realm = 'production'
-        if args.staging:
-            realm = 'staging'
-        if args.dev:
-            realm = 'dev'
+        # Handle internal options for testing inside Backblaze.
+        # These are not documented in the usage string.
+        realm = self._get_realm(args)
 
-        url = self.api.account_info.REALM_URLS[realm]
+        url = self.api.account_info.REALM_URLS.get(realm, realm)
         self._print('Using %s' % url)
 
         if args.applicationKeyId is None:
@@ -339,6 +338,17 @@ class AuthorizeAccount(Command):
             self._print_stderr('ERROR: unable to authorize account: ' + str(e))
             return 1
 
+    @classmethod
+    def _get_realm(cls, args):
+        if args.dev:
+            return 'dev'
+        if args.staging:
+            return 'staging'
+        if args.environment:
+            return args.environment
+
+        return 'production'
+
 
 @B2.register_subcommand
 class CancelAllUnfinishedLargeFiles(Command):
diff --git a/requirements.txt b/requirements.txt
index b1235a4..1006adb 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,5 @@
 arrow>=0.8.0,<0.13.1; python_version <= '3.4'
 arrow>=0.8.0; python_version > '3.4'
-b2sdk>=1.1.0,<1.2.0
+b2sdk>=1.1.3,<1.2.0
 class-registry==2.1.2
 six>=1.13

Please add an option to authorize_account to let me specify a base url.
The goal is to let us run the CLI against other B2 instances without having to change the code to add additional arguments like the "--staging" and "--dev" arguments that currently exist.

Here's a potential example:

   b2 authorize-account --baseUrl https://api.backblazeb2.xyz

thanks,
ab

diff --git a/test/test_console_tool.py b/test/test_console_tool.py
index 8956eec..4e7f652 100644
--- a/test/test_console_tool.py
+++ b/test/test_console_tool.py
@@ -110,6 +110,25 @@ class TestConsoleTool(TestBase):
         # Auth token should be in account info now
         assert self.account_info.get_account_auth_token() is not None
 
+    def test_authorize_towards_custom_realm(self):
+        # Initial condition
+        assert self.account_info.get_account_auth_token() is None
+
+        # Authorize an account with a good api key.
+        expected_stdout = """
+        Using http://custom.example.com
+        """
+
+        self._run_command(
+            [
+                'authorize-account', '--environment', 'http://custom.example.com', self.account_id,
+                self.master_key
+            ], expected_stdout, '', 0
+        )
+
+        # Auth token should be in account info now
+        assert self.account_info.get_account_auth_token() is not None
+
     def test_create_key_and_authorize_with_it(self):
         # Start with authorizing with the master key
         self._authorize_account()

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest
3.8
requirements.txt requirements-test.txt requirements-setup.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
altgraph==0.17.4
arrow==1.3.0
-e git+https://github.com/Backblaze/B2_Command_Line_Tool.git@cd5618431964b317d1bfa03c03f2798afd0c5296#egg=b2
b2sdk==1.1.4
backports.tarfile==1.2.0
certifi==2025.1.31
cffi==1.17.1
charset-normalizer==3.4.1
class-registry==2.1.2
configparser==7.1.0
cryptography==44.0.2
docutils==0.20.1
exceptiongroup==1.2.2
id==1.5.0
idna==3.10
importlib_metadata==8.5.0
importlib_resources==6.4.5
iniconfig==2.1.0
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
jeepney==0.9.0
keyring==25.5.0
liccheck==0.3.9
logfury==1.0.1
markdown-it-py==3.0.0
mdurl==0.1.2
mock==5.2.0
more-itertools==10.5.0
nh3==0.2.21
nose==1.3.7
packaging==24.2
pluggy==1.5.0
pycparser==2.22
pyflakes==3.2.0
Pygments==2.19.1
pyinstaller==6.12.0
pyinstaller-hooks-contrib==2025.2
pytest==8.3.5
python-dateutil==2.9.0.post0
readme_renderer==43.0
requests==2.32.3
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==14.0.0
SecretStorage==3.3.3
six==1.17.0
tomli==2.2.1
tqdm==4.67.1
twine==6.1.0
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.0
urllib3==2.2.3
yapf==0.27.0
zipp==3.20.2

name: B2_Command_Line_Tool
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=24.2=py38h06a4308_0
  - python=3.8.20=he870216_0
  - readline=8.2=h5eee18b_0
  - setuptools=75.1.0=py38h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.44.0=py38h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - altgraph==0.17.4
      - arrow==1.3.0
      - b2sdk==1.1.4
      - backports-tarfile==1.2.0
      - certifi==2025.1.31
      - cffi==1.17.1
      - charset-normalizer==3.4.1
      - class-registry==2.1.2
      - configparser==7.1.0
      - cryptography==44.0.2
      - docutils==0.20.1
      - exceptiongroup==1.2.2
      - id==1.5.0
      - idna==3.10
      - importlib-metadata==8.5.0
      - importlib-resources==6.4.5
      - iniconfig==2.1.0
      - jaraco-classes==3.4.0
      - jaraco-context==6.0.1
      - jaraco-functools==4.1.0
      - jeepney==0.9.0
      - keyring==25.5.0
      - liccheck==0.3.9
      - logfury==1.0.1
      - markdown-it-py==3.0.0
      - mdurl==0.1.2
      - mock==5.2.0
      - more-itertools==10.5.0
      - nh3==0.2.21
      - nose==1.3.7
      - packaging==24.2
      - pluggy==1.5.0
      - pycparser==2.22
      - pyflakes==3.2.0
      - pygments==2.19.1
      - pyinstaller==6.12.0
      - pyinstaller-hooks-contrib==2025.2
      - pytest==8.3.5
      - python-dateutil==2.9.0.post0
      - readme-renderer==43.0
      - requests==2.32.3
      - requests-toolbelt==1.0.0
      - rfc3986==2.0.0
      - rich==14.0.0
      - secretstorage==3.3.3
      - six==1.17.0
      - tomli==2.2.1
      - tqdm==4.67.1
      - twine==6.1.0
      - types-python-dateutil==2.9.0.20241206
      - typing-extensions==4.13.0
      - urllib3==2.2.3
      - yapf==0.27.0
      - zipp==3.20.2
prefix: /opt/conda/envs/B2_Command_Line_Tool

test/test_console_tool.py::TestConsoleTool::test_authorize_towards_custom_realm
test/test_console_tool.py::TestConsoleTool::test_sync_exclude_if_modified_after_exact test/test_console_tool.py::TestConsoleTool::test_sync_exclude_if_modified_after_in_range
test/test_console_tool.py::TestConsoleTool::test_authorize_key_without_list_buckets test/test_console_tool.py::TestConsoleTool::test_authorize_using_env_variables test/test_console_tool.py::TestConsoleTool::test_authorize_with_bad_key test/test_console_tool.py::TestConsoleTool::test_authorize_with_good_key_using_hyphen test/test_console_tool.py::TestConsoleTool::test_authorize_with_good_key_using_underscore test/test_console_tool.py::TestConsoleTool::test_bad_terminal test/test_console_tool.py::TestConsoleTool::test_bucket_info_from_json test/test_console_tool.py::TestConsoleTool::test_bucket_missing_for_bucket_key test/test_console_tool.py::TestConsoleTool::test_buckets test/test_console_tool.py::TestConsoleTool::test_cancel_all_large_file test/test_console_tool.py::TestConsoleTool::test_cancel_large_file test/test_console_tool.py::TestConsoleTool::test_clear_account test/test_console_tool.py::TestConsoleTool::test_copy_file_by_id test/test_console_tool.py::TestConsoleTool::test_create_bucket_key_and_authorize_with_it test/test_console_tool.py::TestConsoleTool::test_create_key_and_authorize_with_it test/test_console_tool.py::TestConsoleTool::test_files test/test_console_tool.py::TestConsoleTool::test_get_account_info test/test_console_tool.py::TestConsoleTool::test_get_bucket test/test_console_tool.py::TestConsoleTool::test_get_bucket_complex test/test_console_tool.py::TestConsoleTool::test_get_bucket_empty_show_size test/test_console_tool.py::TestConsoleTool::test_get_bucket_one_item_show_size test/test_console_tool.py::TestConsoleTool::test_get_bucket_with_folders test/test_console_tool.py::TestConsoleTool::test_get_bucket_with_hidden test/test_console_tool.py::TestConsoleTool::test_get_bucket_with_versions test/test_console_tool.py::TestConsoleTool::test_get_download_auth_defaults test/test_console_tool.py::TestConsoleTool::test_get_download_auth_explicit test/test_console_tool.py::TestConsoleTool::test_get_download_auth_url test/test_console_tool.py::TestConsoleTool::test_get_download_auth_url_with_encoding test/test_console_tool.py::TestConsoleTool::test_keys test/test_console_tool.py::TestConsoleTool::test_list_buckets_not_allowed_for_app_key test/test_console_tool.py::TestConsoleTool::test_list_parts_with_none test/test_console_tool.py::TestConsoleTool::test_list_parts_with_parts test/test_console_tool.py::TestConsoleTool::test_list_unfinished_large_files_with_none test/test_console_tool.py::TestConsoleTool::test_list_unfinished_large_files_with_some test/test_console_tool.py::TestConsoleTool::test_ls test/test_console_tool.py::TestConsoleTool::test_ls_for_restricted_bucket test/test_console_tool.py::TestConsoleTool::test_restrictions test/test_console_tool.py::TestConsoleTool::test_sync test/test_console_tool.py::TestConsoleTool::test_sync_dont_exclude_all_symlinks test/test_console_tool.py::TestConsoleTool::test_sync_dry_run test/test_console_tool.py::TestConsoleTool::test_sync_empty_folder_when_enabled test/test_console_tool.py::TestConsoleTool::test_sync_empty_folder_when_not_enabled test/test_console_tool.py::TestConsoleTool::test_sync_exclude_all_symlinks test/test_console_tool.py::TestConsoleTool::test_upload_large_file
b2/console_tool.py requirements.txt README.md
b2/console_tool.py requirements.txt README.md