Skip to content

az cosmosdb copy create throws exception: cannot import name 'get_arm_endpoints' from 'azure.mgmt.core.tools' #31527

@MarcelWouters

Description

@MarcelWouters

Describe the bug

az cosmosdb copy create gives an error

cannot import name 'get_arm_endpoints' from 'azure.mgmt.core.tools' (/opt/az/lib/python3.12/site-packages/azure/mgmt/core/tools.py)

Related command

az cosmosdb copy create

Errors

2025-05-21T13:28:15.8702906Z File "/opt/az/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
2025-05-21T13:28:15.8703809Z cmd_result = self.invocation.execute(args)
2025-05-21T13:28:15.8704170Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8706080Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 564, in execute
2025-05-21T13:28:15.8706396Z self.commands_loader.load_arguments(command)
2025-05-21T13:28:15.8706723Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/init.py", line 552, in load_arguments
2025-05-21T13:28:15.8707061Z self.command_table[command].load_arguments() # this loads the arguments via reflection
2025-05-21T13:28:15.8707314Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8707919Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 321, in load_arguments
2025-05-21T13:28:15.8708209Z super().load_arguments()
2025-05-21T13:28:15.8708490Z File "/opt/az/lib/python3.12/site-packages/knack/commands.py", line 104, in load_arguments
2025-05-21T13:28:15.8708768Z cmd_args = self.arguments_loader()
2025-05-21T13:28:15.8708975Z ^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8709403Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 124, in arguments_loader
2025-05-21T13:28:15.8709720Z op = self.get_op_handler(self.op_path)
2025-05-21T13:28:15.8709927Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8710207Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 59, in get_op_handler
2025-05-21T13:28:15.8710514Z handler = import_module(mod_to_import)
2025-05-21T13:28:15.8710724Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8710974Z File "/opt/az/lib/python3.12/importlib/init.py", line 90, in import_module
2025-05-21T13:28:15.8711269Z return _bootstrap._gcd_import(name[level:], package, level)
2025-05-21T13:28:15.8711632Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8711867Z File "", line 1387, in _gcd_import
2025-05-21T13:28:15.8712155Z File "", line 1360, in _find_and_load
2025-05-21T13:28:15.8712456Z File "", line 1331, in _find_and_load_unlocked
2025-05-21T13:28:15.8712751Z File "", line 935, in _load_unlocked
2025-05-21T13:28:15.8713043Z File "", line 999, in exec_module
2025-05-21T13:28:15.8713343Z File "", line 488, in _call_with_frames_removed
2025-05-21T13:28:15.8713674Z File "/opt/az/azcliextensions/cosmosdb-preview/azext_cosmosdb_preview/custom.py", line 10, in
2025-05-21T13:28:15.8714030Z from azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models import (
2025-05-21T13:28:15.8714401Z File "/opt/az/azcliextensions/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/init.py", line 15, in
2025-05-21T13:28:15.8714771Z from ._cosmos_db_management_client import CosmosDBManagementClient # type: ignore
2025-05-21T13:28:15.8715026Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8715356Z File "/opt/az/azcliextensions/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/_cosmos_db_management_client.py", line 18, in
2025-05-21T13:28:15.8715721Z from azure.mgmt.core.tools import get_arm_endpoints
2025-05-21T13:28:15.8716090Z ImportError: cannot import name 'get_arm_endpoints' from 'azure.mgmt.core.tools' (/opt/az/lib/python3.12/site-packages/azure/mgmt/core/tools.py)
2025-05-21T13:28:15.8716288Z
2025-05-21T13:28:15.8766661Z ERROR: cli.azure.cli.core.azclierror: The command failed with an unexpected error. Here is the traceback:
2025-05-21T13:28:15.8768652Z ERROR: az_command_data_logger: The command failed with an unexpected error. Here is the traceback:
2025-05-21T13:28:15.8775460Z ERROR: cli.azure.cli.core.azclierror: cannot import name 'get_arm_endpoints' from 'azure.mgmt.core.tools' (/opt/az/lib/python3.12/site-packages/azure/mgmt/core/tools.py)
2025-05-21T13:28:15.8792558Z Traceback (most recent call last):
2025-05-21T13:28:15.8792821Z File "/opt/az/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
2025-05-21T13:28:15.8793066Z cmd_result = self.invocation.execute(args)
2025-05-21T13:28:15.8793257Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8793491Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 564, in execute
2025-05-21T13:28:15.8793772Z self.commands_loader.load_arguments(command)
2025-05-21T13:28:15.8794232Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/init.py", line 552, in load_arguments
2025-05-21T13:28:15.8794531Z self.command_table[command].load_arguments() # this loads the arguments via reflection
2025-05-21T13:28:15.8794753Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8795004Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 321, in load_arguments
2025-05-21T13:28:15.8795259Z super().load_arguments()
2025-05-21T13:28:15.8795581Z File "/opt/az/lib/python3.12/site-packages/knack/commands.py", line 104, in load_arguments
2025-05-21T13:28:15.8795838Z cmd_args = self.arguments_loader()
2025-05-21T13:28:15.8796019Z ^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8796264Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 124, in arguments_loader
2025-05-21T13:28:15.8796533Z op = self.get_op_handler(self.op_path)
2025-05-21T13:28:15.8796715Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8796961Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 59, in get_op_handler
2025-05-21T13:28:15.8797225Z handler = import_module(mod_to_import)
2025-05-21T13:28:15.8797407Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8797632Z File "/opt/az/lib/python3.12/importlib/init.py", line 90, in import_module
2025-05-21T13:28:15.8797886Z return _bootstrap._gcd_import(name[level:], package, level)
2025-05-21T13:28:15.8798090Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8798310Z File "", line 1387, in _gcd_import
2025-05-21T13:28:15.8798556Z File "", line 1360, in _find_and_load
2025-05-21T13:28:15.8798814Z File "", line 1331, in _find_and_load_unlocked
2025-05-21T13:28:15.8799067Z File "", line 935, in _load_unlocked
2025-05-21T13:28:15.8799320Z File "", line 999, in exec_module
2025-05-21T13:28:15.8799590Z File "", line 488, in _call_with_frames_removed
2025-05-21T13:28:15.8799874Z File "/opt/az/azcliextensions/cosmosdb-preview/azext_cosmosdb_preview/custom.py", line 10, in
2025-05-21T13:28:15.8800163Z from azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models import (
2025-05-21T13:28:15.8800488Z File "/opt/az/azcliextensions/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/init.py", line 15, in
2025-05-21T13:28:15.8800810Z from ._cosmos_db_management_client import CosmosDBManagementClient # type: ignore
2025-05-21T13:28:15.8801028Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8801311Z File "/opt/az/azcliextensions/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/_cosmos_db_management_client.py", line 18, in
2025-05-21T13:28:15.8801735Z from azure.mgmt.core.tools import get_arm_endpoints
2025-05-21T13:28:15.8802041Z ImportError: cannot import name 'get_arm_endpoints' from 'azure.mgmt.core.tools' (/opt/az/lib/python3.12/site-packages/azure/mgmt/core/tools.py)
2025-05-21T13:28:15.8802431Z ERROR: az_command_data_logger: cannot import name 'get_arm_endpoints' from 'azure.mgmt.core.tools' (/opt/az/lib/python3.12/site-packages/azure/mgmt/core/tools.py)
2025-05-21T13:28:15.8802735Z Traceback (most recent call last):
2025-05-21T13:28:15.8802969Z File "/opt/az/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
2025-05-21T13:28:15.8803206Z cmd_result = self.invocation.execute(args)
2025-05-21T13:28:15.8803392Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8803637Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 564, in execute
2025-05-21T13:28:15.8803897Z self.commands_loader.load_arguments(command)
2025-05-21T13:28:15.8804223Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/init.py", line 552, in load_arguments
2025-05-21T13:28:15.8804515Z self.command_table[command].load_arguments() # this loads the arguments via reflection
2025-05-21T13:28:15.8804737Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8804974Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 321, in load_arguments
2025-05-21T13:28:15.8805223Z super().load_arguments()
2025-05-21T13:28:15.8805518Z File "/opt/az/lib/python3.12/site-packages/knack/commands.py", line 104, in load_arguments
2025-05-21T13:28:15.8805775Z cmd_args = self.arguments_loader()
2025-05-21T13:28:15.8805954Z ^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8806202Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 124, in arguments_loader
2025-05-21T13:28:15.8806471Z op = self.get_op_handler(self.op_path)
2025-05-21T13:28:15.8806651Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8806898Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 59, in get_op_handler
2025-05-21T13:28:15.8807161Z handler = import_module(mod_to_import)
2025-05-21T13:28:15.8807344Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8807569Z File "/opt/az/lib/python3.12/importlib/init.py", line 90, in import_module
2025-05-21T13:28:15.8807823Z return _bootstrap._gcd_import(name[level:], package, level)
2025-05-21T13:28:15.8808027Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8808227Z File "", line 1387, in _gcd_import
2025-05-21T13:28:15.8808475Z File "", line 1360, in _find_and_load
2025-05-21T13:28:15.8808730Z File "", line 1331, in _find_and_load_unlocked
2025-05-21T13:28:15.8808986Z File "", line 935, in _load_unlocked
2025-05-21T13:28:15.8809239Z File "", line 999, in exec_module
2025-05-21T13:28:15.8809542Z File "", line 488, in _call_with_frames_removed
2025-05-21T13:28:15.8809829Z File "/opt/az/azcliextensions/cosmosdb-preview/azext_cosmosdb_preview/custom.py", line 10, in
2025-05-21T13:28:15.8810118Z from azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models import (
2025-05-21T13:28:15.8810473Z File "/opt/az/azcliextensions/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/init.py", line 15, in
2025-05-21T13:28:15.8810799Z from ._cosmos_db_management_client import CosmosDBManagementClient # type: ignore
2025-05-21T13:28:15.8811020Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8811304Z File "/opt/az/azcliextensions/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/_cosmos_db_management_client.py", line 18, in
2025-05-21T13:28:15.8811706Z from azure.mgmt.core.tools import get_arm_endpoints
2025-05-21T13:28:15.8812015Z ImportError: cannot import name 'get_arm_endpoints' from 'azure.mgmt.core.tools' (/opt/az/lib/python3.12/site-packages/azure/mgmt/core/tools.py)
2025-05-21T13:28:15.8812340Z To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

Issue script & Debug output

2025-05-21T13:28:15.5783017Z DEBUG: cli.knack.cli: init debug log:
2025-05-21T13:28:15.5783863Z Cannot enable color.
2025-05-21T13:28:15.5784189Z DEBUG: cli.knack.cli: Event: Cli.PreExecute []
2025-05-21T13:28:15.5785096Z DEBUG: cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7fd3ddbe79c0>, <function OutputProducer.on_global_arguments at 0x7fd3dd986980>, <function CLIQuery.on_global_arguments at 0x7fd3dd9cfec0>]
2025-05-21T13:28:15.5788299Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
2025-05-21T13:28:15.5795162Z DEBUG: cli.azure.cli.core: Modules found from index for 'cosmosdb': ['azure.cli.command_modules.cosmosdb', 'azext_cosmosdb_preview']
2025-05-21T13:28:15.5799078Z DEBUG: cli.azure.cli.core: Loading command modules:
2025-05-21T13:28:15.5799616Z DEBUG: cli.azure.cli.core: Name Load Time Groups Commands
2025-05-21T13:28:15.7628095Z DEBUG: cli.azure.cli.core: cosmosdb 0.183 58 200
2025-05-21T13:28:15.7628970Z DEBUG: cli.azure.cli.core: Total (1) 0.183 58 200
2025-05-21T13:28:15.7635914Z DEBUG: cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
2025-05-21T13:28:15.7638100Z DEBUG: cli.azure.cli.core: Loading extensions:
2025-05-21T13:28:15.7639834Z DEBUG: cli.azure.cli.core: Name Load Time Groups Commands Directory
2025-05-21T13:28:15.7736207Z DEBUG: cli.azure.cli.core: cosmosdb-preview 0.007 48 137 /opt/az/azcliextensions/cosmosdb-preview
2025-05-21T13:28:15.7736811Z DEBUG: cli.azure.cli.core: Total (1) 0.007 48 137
2025-05-21T13:28:15.7737287Z DEBUG: cli.azure.cli.core: Loaded 77 groups, 281 commands.
2025-05-21T13:28:15.7737858Z DEBUG: cli.azure.cli.core: Found a match in the command table.
2025-05-21T13:28:15.7738377Z DEBUG: cli.azure.cli.core: Raw command : cosmosdb copy create
2025-05-21T13:28:15.7738754Z DEBUG: cli.azure.cli.core: Command table: cosmosdb copy create
2025-05-21T13:28:15.7739235Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7fd3dcc0c540>]
2025-05-21T13:28:15.7746201Z DEBUG: cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/vsts/work/_temp/.azclitask/commands/2025-05-21.13-28-15.cosmosdb_copy_create.3389.log'.
2025-05-21T13:28:15.7746663Z INFO: az_command_data_logger: command args: cosmosdb copy create -g {} --job-name {} --src-account {} --src-nosql {} {} --dest-account {} --dest-nosql {} {} --verbose --debug
2025-05-21T13:28:15.7747069Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x7fd3dcc5ca40>]
2025-05-21T13:28:15.8702031Z DEBUG: cli.azure.cli.core.azclierror: Traceback (most recent call last):
2025-05-21T13:28:15.8702906Z File "/opt/az/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
2025-05-21T13:28:15.8703809Z cmd_result = self.invocation.execute(args)
2025-05-21T13:28:15.8704170Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8706080Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 564, in execute
2025-05-21T13:28:15.8706396Z self.commands_loader.load_arguments(command)
2025-05-21T13:28:15.8706723Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/init.py", line 552, in load_arguments
2025-05-21T13:28:15.8707061Z self.command_table[command].load_arguments() # this loads the arguments via reflection
2025-05-21T13:28:15.8707314Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8707919Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 321, in load_arguments
2025-05-21T13:28:15.8708209Z super().load_arguments()
2025-05-21T13:28:15.8708490Z File "/opt/az/lib/python3.12/site-packages/knack/commands.py", line 104, in load_arguments
2025-05-21T13:28:15.8708768Z cmd_args = self.arguments_loader()
2025-05-21T13:28:15.8708975Z ^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8709403Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 124, in arguments_loader
2025-05-21T13:28:15.8709720Z op = self.get_op_handler(self.op_path)
2025-05-21T13:28:15.8709927Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8710207Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 59, in get_op_handler
2025-05-21T13:28:15.8710514Z handler = import_module(mod_to_import)
2025-05-21T13:28:15.8710724Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8710974Z File "/opt/az/lib/python3.12/importlib/init.py", line 90, in import_module
2025-05-21T13:28:15.8711269Z return _bootstrap._gcd_import(name[level:], package, level)
2025-05-21T13:28:15.8711632Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8711867Z File "", line 1387, in _gcd_import
2025-05-21T13:28:15.8712155Z File "", line 1360, in _find_and_load
2025-05-21T13:28:15.8712456Z File "", line 1331, in _find_and_load_unlocked
2025-05-21T13:28:15.8712751Z File "", line 935, in _load_unlocked
2025-05-21T13:28:15.8713043Z File "", line 999, in exec_module
2025-05-21T13:28:15.8713343Z File "", line 488, in _call_with_frames_removed
2025-05-21T13:28:15.8713674Z File "/opt/az/azcliextensions/cosmosdb-preview/azext_cosmosdb_preview/custom.py", line 10, in
2025-05-21T13:28:15.8714030Z from azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models import (
2025-05-21T13:28:15.8714401Z File "/opt/az/azcliextensions/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/init.py", line 15, in
2025-05-21T13:28:15.8714771Z from ._cosmos_db_management_client import CosmosDBManagementClient # type: ignore
2025-05-21T13:28:15.8715026Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8715356Z File "/opt/az/azcliextensions/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/_cosmos_db_management_client.py", line 18, in
2025-05-21T13:28:15.8715721Z from azure.mgmt.core.tools import get_arm_endpoints
2025-05-21T13:28:15.8716090Z ImportError: cannot import name 'get_arm_endpoints' from 'azure.mgmt.core.tools' (/opt/az/lib/python3.12/site-packages/azure/mgmt/core/tools.py)
2025-05-21T13:28:15.8716288Z
2025-05-21T13:28:15.8766661Z ERROR: cli.azure.cli.core.azclierror: The command failed with an unexpected error. Here is the traceback:
2025-05-21T13:28:15.8768652Z ERROR: az_command_data_logger: The command failed with an unexpected error. Here is the traceback:
2025-05-21T13:28:15.8775460Z ERROR: cli.azure.cli.core.azclierror: cannot import name 'get_arm_endpoints' from 'azure.mgmt.core.tools' (/opt/az/lib/python3.12/site-packages/azure/mgmt/core/tools.py)
2025-05-21T13:28:15.8792558Z Traceback (most recent call last):
2025-05-21T13:28:15.8792821Z File "/opt/az/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
2025-05-21T13:28:15.8793066Z cmd_result = self.invocation.execute(args)
2025-05-21T13:28:15.8793257Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8793491Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 564, in execute
2025-05-21T13:28:15.8793772Z self.commands_loader.load_arguments(command)
2025-05-21T13:28:15.8794232Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/init.py", line 552, in load_arguments
2025-05-21T13:28:15.8794531Z self.command_table[command].load_arguments() # this loads the arguments via reflection
2025-05-21T13:28:15.8794753Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8795004Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 321, in load_arguments
2025-05-21T13:28:15.8795259Z super().load_arguments()
2025-05-21T13:28:15.8795581Z File "/opt/az/lib/python3.12/site-packages/knack/commands.py", line 104, in load_arguments
2025-05-21T13:28:15.8795838Z cmd_args = self.arguments_loader()
2025-05-21T13:28:15.8796019Z ^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8796264Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 124, in arguments_loader
2025-05-21T13:28:15.8796533Z op = self.get_op_handler(self.op_path)
2025-05-21T13:28:15.8796715Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8796961Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 59, in get_op_handler
2025-05-21T13:28:15.8797225Z handler = import_module(mod_to_import)
2025-05-21T13:28:15.8797407Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8797632Z File "/opt/az/lib/python3.12/importlib/init.py", line 90, in import_module
2025-05-21T13:28:15.8797886Z return _bootstrap._gcd_import(name[level:], package, level)
2025-05-21T13:28:15.8798090Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8798310Z File "", line 1387, in _gcd_import
2025-05-21T13:28:15.8798556Z File "", line 1360, in _find_and_load
2025-05-21T13:28:15.8798814Z File "", line 1331, in _find_and_load_unlocked
2025-05-21T13:28:15.8799067Z File "", line 935, in _load_unlocked
2025-05-21T13:28:15.8799320Z File "", line 999, in exec_module
2025-05-21T13:28:15.8799590Z File "", line 488, in _call_with_frames_removed
2025-05-21T13:28:15.8799874Z File "/opt/az/azcliextensions/cosmosdb-preview/azext_cosmosdb_preview/custom.py", line 10, in
2025-05-21T13:28:15.8800163Z from azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models import (
2025-05-21T13:28:15.8800488Z File "/opt/az/azcliextensions/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/init.py", line 15, in
2025-05-21T13:28:15.8800810Z from ._cosmos_db_management_client import CosmosDBManagementClient # type: ignore
2025-05-21T13:28:15.8801028Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8801311Z File "/opt/az/azcliextensions/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/_cosmos_db_management_client.py", line 18, in
2025-05-21T13:28:15.8801735Z from azure.mgmt.core.tools import get_arm_endpoints
2025-05-21T13:28:15.8802041Z ImportError: cannot import name 'get_arm_endpoints' from 'azure.mgmt.core.tools' (/opt/az/lib/python3.12/site-packages/azure/mgmt/core/tools.py)
2025-05-21T13:28:15.8802431Z ERROR: az_command_data_logger: cannot import name 'get_arm_endpoints' from 'azure.mgmt.core.tools' (/opt/az/lib/python3.12/site-packages/azure/mgmt/core/tools.py)
2025-05-21T13:28:15.8802735Z Traceback (most recent call last):
2025-05-21T13:28:15.8802969Z File "/opt/az/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
2025-05-21T13:28:15.8803206Z cmd_result = self.invocation.execute(args)
2025-05-21T13:28:15.8803392Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8803637Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 564, in execute
2025-05-21T13:28:15.8803897Z self.commands_loader.load_arguments(command)
2025-05-21T13:28:15.8804223Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/init.py", line 552, in load_arguments
2025-05-21T13:28:15.8804515Z self.command_table[command].load_arguments() # this loads the arguments via reflection
2025-05-21T13:28:15.8804737Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8804974Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 321, in load_arguments
2025-05-21T13:28:15.8805223Z super().load_arguments()
2025-05-21T13:28:15.8805518Z File "/opt/az/lib/python3.12/site-packages/knack/commands.py", line 104, in load_arguments
2025-05-21T13:28:15.8805775Z cmd_args = self.arguments_loader()
2025-05-21T13:28:15.8805954Z ^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8806202Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 124, in arguments_loader
2025-05-21T13:28:15.8806471Z op = self.get_op_handler(self.op_path)
2025-05-21T13:28:15.8806651Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8806898Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 59, in get_op_handler
2025-05-21T13:28:15.8807161Z handler = import_module(mod_to_import)
2025-05-21T13:28:15.8807344Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8807569Z File "/opt/az/lib/python3.12/importlib/init.py", line 90, in import_module
2025-05-21T13:28:15.8807823Z return _bootstrap._gcd_import(name[level:], package, level)
2025-05-21T13:28:15.8808027Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8808227Z File "", line 1387, in _gcd_import
2025-05-21T13:28:15.8808475Z File "", line 1360, in _find_and_load
2025-05-21T13:28:15.8808730Z File "", line 1331, in _find_and_load_unlocked
2025-05-21T13:28:15.8808986Z File "", line 935, in _load_unlocked
2025-05-21T13:28:15.8809239Z File "", line 999, in exec_module
2025-05-21T13:28:15.8809542Z File "", line 488, in _call_with_frames_removed
2025-05-21T13:28:15.8809829Z File "/opt/az/azcliextensions/cosmosdb-preview/azext_cosmosdb_preview/custom.py", line 10, in
2025-05-21T13:28:15.8810118Z from azext_cosmosdb_preview.vendored_sdks.azure_mgmt_cosmosdb.models import (
2025-05-21T13:28:15.8810473Z File "/opt/az/azcliextensions/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/init.py", line 15, in
2025-05-21T13:28:15.8810799Z from ._cosmos_db_management_client import CosmosDBManagementClient # type: ignore
2025-05-21T13:28:15.8811020Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-05-21T13:28:15.8811304Z File "/opt/az/azcliextensions/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/_cosmos_db_management_client.py", line 18, in
2025-05-21T13:28:15.8811706Z from azure.mgmt.core.tools import get_arm_endpoints
2025-05-21T13:28:15.8812015Z ImportError: cannot import name 'get_arm_endpoints' from 'azure.mgmt.core.tools' (/opt/az/lib/python3.12/site-packages/azure/mgmt/core/tools.py)
2025-05-21T13:28:15.8812340Z To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
2025-05-21T13:28:15.8812646Z DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7fd3dcc0c7c0>]
2025-05-21T13:28:15.8812921Z INFO: az_command_data_logger: exit code: 1
2025-05-21T13:28:15.8813163Z INFO: cli.main: Command ran in 0.466 seconds (init: 0.163, invoke: 0.303)
2025-05-21T13:28:15.9621572Z INFO: telemetry.main: Begin splitting cli events and extra events, total events: 1
2025-05-21T13:28:15.9628292Z INFO: telemetry.client: Accumulated 0 events. Flush the clients.
2025-05-21T13:28:15.9628586Z INFO: telemetry.main: Finish splitting cli events and extra events, cli events: 1
2025-05-21T13:28:15.9629198Z INFO: telemetry.save: Save telemetry record of length 8123 in cache file under /home/vsts/work/_temp/.azclitask/telemetry/20250521132815961
2025-05-21T13:28:15.9629509Z INFO: telemetry.main: Begin creating telemetry upload process.
2025-05-21T13:28:15.9629901Z INFO: telemetry.process: Creating upload process: "/opt/az/bin/python3 /opt/az/lib/python3.12/site-packages/azure/cli/telemetry/init.py /home/vsts/work/_temp/.azclitask /home/vsts/work/_temp/.azclitask/telemetry/20250521132815961"
2025-05-21T13:28:15.9655237Z INFO: telemetry.process: Return from creating process 3394
2025-05-21T13:28:15.9656482Z INFO: telemetry.main: Finish creating telemetry upload process.
2025-05-21T13:28:26.7649985Z �[31;1maz-ps : �[31;1maz cosmosdb copy show -g rem-rg --account-name reasult-rem-internal-dbact --job-name 93b57cc2-5096-4787-9169-b9337248aa84 returned error ERROR: The command failed with an unexpected error. Here is the traceback: ERROR: cannot import name 'get_arm_endpoints' from 'azure.mgmt.core.tools' (/opt/az/lib/python3.12/site-packages/azure/mgmt/core/tools.py) Traceback (most recent call last): File "/opt/az/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 564, in execute self.commands_loader.load_arguments(command) File "/opt/az/lib/python3.12/site-packages/azure/cli/core/init.py", line 552, in load_arguments self.command_table[command].load_arguments() # this loads the arguments via reflection ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 321, in load_arguments super().load_arguments() File "/opt/az/lib/python3.12/site-packages/knack/commands.py", line 104, in load_arguments cmd_args = self.arguments_loader() ^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 366, in arguments_loader cmd_args = self.load_getter_op_arguments(self.op_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 70, in load_getter_op_arguments op = self.get_op_handler(getter_op_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 59, in get_op_handler handler = import_module(mod_to_import) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.12/importlib/init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1310, in _find_and_load_unlocked File "", line 488, in _call_with_frames_removed File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1310, in _find_and_load_unlocked File "", line 488, in _call_with_frames_removed File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "", line 999, in exec_module File "", line 488, in _call_with_frames_removed File "/opt/az/azcliextensions/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/init.py", line 15, in from ._cosmos_db_management_client import CosmosDBManagementClient # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/az/azcliextensions/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/_cosmos_db_management_client.py", line 18, in from azure.mgmt.core.tools import get_arm_endpoints ImportError: cannot import name 'get_arm_endpoints' from 'azure.mgmt.core.tools' (/opt/az/lib/python3.12/site-packages/azure/mgmt/core/tools.py) To check existing issues, please visit: https://github.com/Azure/azure-cli/issues�[0m

Expected behavior

Expect no errors when running the command.

Environment Summary

cosmosdb-preview extension 1.5.0

azure-cli 2.72.0 *

core 2.72.0 *
telemetry 1.1.0

Extensions:
azure-devops 1.0.1

Dependencies:
msal 1.32.3
azure-mgmt-resource 23.1.1

Python location '/opt/az/bin/python3'
Config directory '/home/vsts/.azure'
Extensions directory '/opt/az/azcliextensions'

Python (Linux) 3.12.8 (main, Apr 28 2025, 09:24:43) [GCC 11.4.0]

Additional context

running az command from Azure DevOps pipeline with ubuntu-22.04 agent.

Task : Azure CLI
Description : Run Azure CLI commands against an Azure subscription in a PowerShell Core/Shell script when running on Linux agent or PowerShell/PowerShell Core/Batch script when running on Windows agent.
Version : 2.256.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-cli

Metadata

Metadata

Assignees

No one assigned

    Labels

    Auto-AssignAuto assign by botAuto-ResolveAuto resolve by botCosmosDBaz cosmosdbService AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions