Skip to content

az storage blob copy start fails when --destination-blob-type is set #31313

@dsshen

Description

@dsshen

Describe the bug

Reproduction steps:

  • Create a storage account mystorageaccount and a service principal with "Storage Blob Data Contributor" permission to the storage account
  • Login to az cli as the service principal
  • Create a blob container mycontainer inside mystorageaccount and upload a test blob file hello.txt to the container
  • Attempt to copy the hello.txt blob using az storage blob copy start with and without the --destination-blob-type flag set, and observe that the command succeeds and fails respectively.

This behavior appears to be a regression in CLI version 2.71.0 and cannot be reproduced on versions <= 2.70.0.

Related command

# succeeds
az storage blob copy start \
  --source-container mycontainer \
  --source-blob hello.txt \
  --destination-container mycontainer \
  --destination-blob hello-copy.txt \
  --account-name mystorageaccount \
  --auth-mode login

# fails on 2.71.0
az storage blob copy start \
  --source-container mycontainer \
  --source-blob hello.txt \
  --destination-container mycontainer \
  --destination-blob hello-copy.txt \
  --destination-blob-type BlockBlob \
  --account-name mystorageaccount \
  --auth-mode login

Errors

The command failed with an unexpected error. Here is the traceback:
Unsupported credential: <azure.cli.core.auth.msal_credentials.ServicePrincipalCredential object at 0x7f72bb8be5d0>
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 666, in execute
    raise ex
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 734, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_job
    return cmd_copy.exception_handler(ex)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/storage/__init__.py", line 430, in new_handler
    first(ex)
  File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/storage/__init__.py", line 429, in new_handler
    raise ex
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 703, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 336, in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 120, in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/storage/operations/blob.py", line 1048, in copy_blob
    source_url = generate_sas_blob_uri(cmd, blob_service_client, full_uri=True, blob_url=source_url,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/storage/operations/blob.py", line 853, in generate_sas_blob_uri
    blob_client = t_blob_client.from_blob_url(blob_url=blob_url, credential=credential, snapshot=snapshot)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/multiapi/storagev2/blob/v2022_11_02/_blob_client.py", line 289, in from_blob_url
    return cls(
           ^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/multiapi/storagev2/blob/v2022_11_02/_blob_client.py", line 186, in __init__
    super(BlobClient, self).__init__(parsed_url, service='blob', credential=credential, **kwargs)
  File "/opt/az/lib/python3.12/site-packages/azure/multiapi/storagev2/blob/v2022_11_02/_shared/base_client.py", line 109, in __init__
    self._config, self._pipeline = self._create_pipeline(self.credential, storage_sdk=service, **kwargs)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/multiapi/storagev2/blob/v2022_11_02/_shared/base_client.py", line 227, in _create_pipeline
    raise TypeError(f"Unsupported credential: {credential}")
TypeError: Unsupported credential: <azure.cli.core.auth.msal_credentials.ServicePrincipalCredential object at 0x7f72bb8be5d0>

Issue script & Debug output

guest@P-DV-LAP-DSHE:/mnt/c/users/daniel.shen/Desktop$ az storage blob copy start   --source-container [REDACTED]   --source-blob hello.txt   --destination-container [REDACTED]   --destination-blob hello-copy.txt   --destination-blob-type BlockBlob   --account-name [REDACTED]   --auth-mode login --debug
cli.knack.cli: Command arguments: ['storage', 'blob', 'copy', 'start', '--source-container', '[REDACTED]', '--source-blob', 'hello.txt', '--destination-container', '[REDACTED]', '--destination-blob', 'hello-copy.txt', '--destination-blob-type', 'BlockBlob', '--account-name', '[REDACTED]', '--auth-mode', 'login', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7f6929c5b880>, <function OutputProducer.on_global_arguments at 0x7f69299a6840>, <function CLIQuery.on_global_arguments at 0x7f69299ebd80>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'storage': ['azure.cli.command_modules.storage']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name                  Load Time    Groups  Commands
cli.azure.cli.core: storage                   0.125        60       275
cli.azure.cli.core: Total (1)                 0.125        60       275
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name                  Load Time    Groups  Commands  Directory
cli.azure.cli.core: Total (0)                 0.000         0         0
cli.azure.cli.core: Loaded 60 groups, 275 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command  : storage blob copy start
cli.azure.cli.core: Command table: storage blob copy start
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7f6928c282c0>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/guest/.azure/commands/2025-04-22.12-06-32.storage_blob_copy_start.39510.log'.
az_command_data_logger: command args: storage blob copy start --source-container {} --source-blob {} --destination-container {} --destination-blob {} --destination-blob-type {} --account-name {} --auth-mode {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x7f6928c8b060>]
cli.azure.cli.core.profiles._shared: Traceback (most recent call last):
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 657, in _get_attr
    op = getattr(op, part)
         ^^^^^^^^^^^^^^^^^
AttributeError: module 'azure.mgmt.storage.v2024_01_01.models' has no attribute 'ActiveDirectoryPropertiesAccountType'

cli.azure.cli.core.profiles._shared: Traceback (most recent call last):
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 657, in _get_attr
    op = getattr(op, part)
         ^^^^^^^^^^^^^^^^^
AttributeError: module 'azure.mgmt.storage.v2024_01_01.models' has no attribute 'ListKeyExpand'

cli.azure.cli.core.profiles._shared: Traceback (most recent call last):
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 657, in _get_attr
    op = getattr(op, part)
         ^^^^^^^^^^^^^^^^^
AttributeError: module 'azure.mgmt.storage.v2024_01_01.models' has no attribute 'CorsRuleAllowedMethodsItem'

cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x7f6928c8b100>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x7f6928c8b240>, <function register_upcoming_breaking_change_info.<locals>.update_breaking_change_info at 0x7f6928c8b2e0>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7f69299a68e0>, <function CLIQuery.handle_query_parameter at 0x7f69299ebe20>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x7f6928c8b1a0>]
cli.azure.cli.core.auth.persistence: build_persistence: location='/home/guest/.azure/service_principal_entries.json', encrypt=False
cli.azure.cli.core.auth.persistence: build_persistence: location='/home/guest/.azure/msal_token_cache.json', encrypt=False
cli.azure.cli.core.auth.binary_cache: load: /home/guest/.azure/msal_http_cache.bin
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
msal.authority: Initializing with Entra authority: https://login.microsoftonline.com/[REDACTED]
msal.authority: openid_config("https://login.microsoftonline.com/[REDACTED]/v2.0/.well-known/openid-configuration") = {'token_endpoint': 'https://login.microsoftonline.com/[REDACTED]/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/[REDACTED]/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/[REDACTED]/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/[REDACTED]/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/[REDACTED]/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/[REDACTED]/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/[REDACTED]/kerberos', 'tenant_region_scope': 'NA', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
msal.application: Broker enabled? None
cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token_info: scopes=('https://storage.azure.com/.default',), options={}
cli.azure.cli.core.auth.msal_credentials: ServicePrincipalCredential.acquire_token: scopes=['https://storage.azure.com/.default'], kwargs={}
msal.application: Cache hit an AT
msal.telemetry: Generate or reuse correlation_id: a263d112-b57c-4270-9468-2a380bb811ad
urllib3.connectionpool: Starting new HTTPS connection (1): [REDACTED].blob.core.windows.net:443
urllib3.connectionpool: https://[REDACTED].blob.core.windows.net:443 "POST /?restype=service&comp=userdelegationkey HTTP/1.1" 200 None
cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token_info: scopes=('https://storage.azure.com/.default',), options={}
cli.azure.cli.core.auth.msal_credentials: ServicePrincipalCredential.acquire_token: scopes=['https://storage.azure.com/.default'], kwargs={}
msal.application: Cache hit an AT
msal.telemetry: Generate or reuse correlation_id: 580106b3-43d4-48f7-9c35-ac2377d95c7a
urllib3.connectionpool: Starting new HTTPS connection (1): [REDACTED].blob.core.windows.net:443
urllib3.connectionpool: https://[REDACTED].blob.core.windows.net:443 "POST /?restype=service&comp=userdelegationkey HTTP/1.1" 200 None
cli.azure.cli.core.azclierror: 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 666, in execute
    raise ex
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 734, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_job
    return cmd_copy.exception_handler(ex)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/storage/__init__.py", line 430, in new_handler
    first(ex)
  File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/storage/__init__.py", line 429, in new_handler
    raise ex
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 703, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 336, in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 120, in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/storage/operations/blob.py", line 1048, in copy_blob
    source_url = generate_sas_blob_uri(cmd, blob_service_client, full_uri=True, blob_url=source_url,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/storage/operations/blob.py", line 853, in generate_sas_blob_uri
    blob_client = t_blob_client.from_blob_url(blob_url=blob_url, credential=credential, snapshot=snapshot)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/multiapi/storagev2/blob/v2022_11_02/_blob_client.py", line 289, in from_blob_url
    return cls(
           ^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/multiapi/storagev2/blob/v2022_11_02/_blob_client.py", line 186, in __init__
    super(BlobClient, self).__init__(parsed_url, service='blob', credential=credential, **kwargs)
  File "/opt/az/lib/python3.12/site-packages/azure/multiapi/storagev2/blob/v2022_11_02/_shared/base_client.py", line 109, in __init__
    self._config, self._pipeline = self._create_pipeline(self.credential, storage_sdk=service, **kwargs)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/multiapi/storagev2/blob/v2022_11_02/_shared/base_client.py", line 227, in _create_pipeline
    raise TypeError(f"Unsupported credential: {credential}")
TypeError: Unsupported credential: <azure.cli.core.auth.msal_credentials.ServicePrincipalCredential object at 0x7f692682e390>

cli.azure.cli.core.azclierror: The command failed with an unexpected error. Here is the traceback:
az_command_data_logger: The command failed with an unexpected error. Here is the traceback:
cli.azure.cli.core.azclierror: Unsupported credential: <azure.cli.core.auth.msal_credentials.ServicePrincipalCredential object at 0x7f692682e390>
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 666, in execute
    raise ex
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 734, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_job
    return cmd_copy.exception_handler(ex)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/storage/__init__.py", line 430, in new_handler
    first(ex)
  File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/storage/__init__.py", line 429, in new_handler
    raise ex
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 703, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 336, in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 120, in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/storage/operations/blob.py", line 1048, in copy_blob
    source_url = generate_sas_blob_uri(cmd, blob_service_client, full_uri=True, blob_url=source_url,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/storage/operations/blob.py", line 853, in generate_sas_blob_uri
    blob_client = t_blob_client.from_blob_url(blob_url=blob_url, credential=credential, snapshot=snapshot)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/multiapi/storagev2/blob/v2022_11_02/_blob_client.py", line 289, in from_blob_url
    return cls(
           ^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/multiapi/storagev2/blob/v2022_11_02/_blob_client.py", line 186, in __init__
    super(BlobClient, self).__init__(parsed_url, service='blob', credential=credential, **kwargs)
  File "/opt/az/lib/python3.12/site-packages/azure/multiapi/storagev2/blob/v2022_11_02/_shared/base_client.py", line 109, in __init__
    self._config, self._pipeline = self._create_pipeline(self.credential, storage_sdk=service, **kwargs)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/multiapi/storagev2/blob/v2022_11_02/_shared/base_client.py", line 227, in _create_pipeline
    raise TypeError(f"Unsupported credential: {credential}")
TypeError: Unsupported credential: <azure.cli.core.auth.msal_credentials.ServicePrincipalCredential object at 0x7f692682e390>
az_command_data_logger: Unsupported credential: <azure.cli.core.auth.msal_credentials.ServicePrincipalCredential object at 0x7f692682e390>
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 666, in execute
    raise ex
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 734, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_job
    return cmd_copy.exception_handler(ex)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/storage/__init__.py", line 430, in new_handler
    first(ex)
  File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/storage/__init__.py", line 429, in new_handler
    raise ex
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 703, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 336, in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 120, in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/storage/operations/blob.py", line 1048, in copy_blob
    source_url = generate_sas_blob_uri(cmd, blob_service_client, full_uri=True, blob_url=source_url,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/storage/operations/blob.py", line 853, in generate_sas_blob_uri
    blob_client = t_blob_client.from_blob_url(blob_url=blob_url, credential=credential, snapshot=snapshot)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/multiapi/storagev2/blob/v2022_11_02/_blob_client.py", line 289, in from_blob_url
    return cls(
           ^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/multiapi/storagev2/blob/v2022_11_02/_blob_client.py", line 186, in __init__
    super(BlobClient, self).__init__(parsed_url, service='blob', credential=credential, **kwargs)
  File "/opt/az/lib/python3.12/site-packages/azure/multiapi/storagev2/blob/v2022_11_02/_shared/base_client.py", line 109, in __init__
    self._config, self._pipeline = self._create_pipeline(self.credential, storage_sdk=service, **kwargs)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/multiapi/storagev2/blob/v2022_11_02/_shared/base_client.py", line 227, in _create_pipeline
    raise TypeError(f"Unsupported credential: {credential}")
TypeError: Unsupported credential: <azure.cli.core.auth.msal_credentials.ServicePrincipalCredential object at 0x7f692682e390>
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f6928c28540>]
az_command_data_logger: exit code: 1
cli.__main__: Command ran in 1.045 seconds (init: 0.096, invoke: 0.948)
telemetry.main: Begin splitting cli events and extra events, total events: 1
telemetry.client: Accumulated 0 events. Flush the clients.
telemetry.main: Finish splitting cli events and extra events, cli events: 1
telemetry.save: Save telemetry record of length 8336 in cache file under /home/guest/.azure/telemetry/20250422120633181
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "/opt/az/bin/python3 /opt/az/lib/python3.12/site-packages/azure/cli/telemetry/__init__.py /home/guest/.azure /home/guest/.azure/telemetry/20250422120633181"
telemetry.process: Return from creating process 39519
telemetry.main: Finish creating telemetry upload process.

Expected behavior

az storage blob copy start should still work when --destination-blob-type is set

Environment Summary

azure-cli                         2.71.0

core                              2.71.0
telemetry                          1.1.0

Extensions:
account                            0.2.5

Dependencies:
msal                            1.31.2b1
azure-mgmt-resource               23.1.1

Python location '/opt/az/bin/python3'
Config directory '/home/guest/.azure'
Extensions directory '/home/guest/.azure/cliextensions'

Python (Linux) 3.12.8 (main, Mar 25 2025, 10:54:53) [GCC 11.4.0]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

Additional context

The issue can also be reproduced if I login via UserCredential with the appropriate storage account permissions (does not only occur using service principals), the error message in this case is TypeError: Unsupported credential: <azure.cli.core.auth.msal_credentials.UserCredential object at 0x7f7d8f4a2870> but is otherwise the same, and similarly can only be reproduced on 2.71.0.

I spot-checked various other az storage commands, like az storage blob upload (both with and without --type flag set), az storage blob download, az storage blob delete, and az storage blob metadata show and those all still appear to work as expected.

It is unclear if this bug is related to the previously reported issue here #31187 (comment)

Metadata

Metadata

Labels

Auto-AssignAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamStorageaz storagecustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions