Skip to content

azure-cli 2.77.0 "a bytes-like object is required, not 'str'" issueΒ #32091

@Ra-VV

Description

@Ra-VV

Describe the bug

My yaml file was untouched and worked in August, today there is an error: 2025-09-10T08:24:55.6877797Z ERROR: The command failed with an unexpected error. Here is the traceback:
2025-09-10T08:24:55.6895046Z ERROR: a bytes-like object is required, not 'str'

Related command

az storage blob download-batch --destination $(Build.SourcesDirectory)/csv --source $(CONTAINER_NAME) --account-name $(STORAGE_ACCOUNT) --auth-mode key

also the same with a variable from the library

az storage blob download-batch --destination $(Build.SourcesDirectory)/csv --source $(CONTAINER_NAME) --account-name $(STORAGE_ACCOUNT) --auth-key $(STORAGE_ACCOUNT_KEY)

Errors

2025-09-10T08:24:55.6877733Z ERROR: The command failed with an unexpected error. Here is the traceback:
2025-09-10T08:24:55.6895034Z ERROR: a bytes-like object is required, not 'str'
2025-09-10T08:24:55.6895627Z Traceback (most recent call last):
2025-09-10T08:24:55.6896299Z File "/opt/az/lib/python3.13/site-packages/knack/cli.py", line 233, in invoke
2025-09-10T08:24:55.6918761Z cmd_result = self.invocation.execute(args)
2025-09-10T08:24:55.6919425Z File "/opt/az/lib/python3.13/site-packages/azure/cli/core/commands/init.py", line 666, in execute
2025-09-10T08:24:55.6919972Z raise ex
2025-09-10T08:24:55.6920534Z File "/opt/az/lib/python3.13/site-packages/azure/cli/core/commands/init.py", line 734, in _run_jobs_serially
2025-09-10T08:24:55.6921164Z results.append(self._run_job(expanded_arg, cmd_copy))
2025-09-10T08:24:55.6921899Z ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
2025-09-10T08:24:55.6922454Z File "/opt/az/lib/python3.13/site-packages/azure/cli/core/commands/init.py", line 726, in _run_job
2025-09-10T08:24:55.6923134Z return cmd_copy.exception_handler(ex)
2025-09-10T08:24:55.6923653Z ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^
2025-09-10T08:24:55.6924243Z File "/opt/az/lib/python3.13/site-packages/azure/cli/command_modules/storage/init.py", line 358, in new_handler
2025-09-10T08:24:55.6924830Z first(ex)
2025-09-10T08:24:55.6925232Z ~~~~~^^^^
2025-09-10T08:24:55.6925703Z File "/opt/az/lib/python3.13/site-packages/azure/cli/command_modules/storage/init.py", line 358, in new_handler
2025-09-10T08:24:55.6926194Z first(ex)
2025-09-10T08:24:55.6926596Z ~~~~~^^^^
2025-09-10T08:24:55.6927183Z File "/opt/az/lib/python3.13/site-packages/azure/cli/command_modules/storage/_exception_handler.py", line 17, in file_related_exception_handler
2025-09-10T08:24:55.6928094Z raise ex
2025-09-10T08:24:55.6928616Z File "/opt/az/lib/python3.13/site-packages/azure/cli/core/commands/init.py", line 703, in _run_job
2025-09-10T08:24:55.6929374Z result = cmd_copy(params)
2025-09-10T08:24:55.6929903Z File "/opt/az/lib/python3.13/site-packages/azure/cli/core/commands/init.py", line 336, in call
2025-09-10T08:24:55.6930507Z return self.handler(*args, **kwargs)
2025-09-10T08:24:55.6934620Z ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
2025-09-10T08:24:55.6935243Z File "/opt/az/lib/python3.13/site-packages/azure/cli/core/commands/command_operation.py", line 120, in handler
2025-09-10T08:24:55.6935798Z return op(**command_args)
2025-09-10T08:24:55.6936334Z File "/opt/az/lib/python3.13/site-packages/azure/cli/command_modules/storage/operations/blob.py", line 421, in storage_blob_download_batch
2025-09-10T08:24:55.6936949Z normalized_blob_name = normalize_blob_file_path(None, blob_name)
2025-09-10T08:24:55.6937564Z File "/opt/az/lib/python3.13/site-packages/azure/cli/command_modules/storage/util.py", line 239, in normalize_blob_file_path
2025-09-10T08:24:55.6938259Z return path_sep.join(os.path.normpath(name).split(os.path.sep)).strip(path_sep)
2025-09-10T08:24:55.6938894Z ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
2025-09-10T08:24:55.6939704Z TypeError: a bytes-like object is required, not 'str'
2025-09-10T08:24:55.6940376Z To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
2025-09-10T08:24:55.8486612Z
2025-09-10T08:24:55.8552360Z ##[error]Script failed with exit code: 1
2025-09-10T08:24:55.8560444Z [command]/usr/bin/az account clear
2025-09-10T08:24:56.4305706Z ##[section]Finishing: Download All CSV Files from Azure Blob Storage

Issue script & Debug output

TypeError: a bytes-like object is required, not 'str'
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

Expected behavior

I need it to work like with this configuration
azure-cli 2.75.0 *

core 2.75.0 *
telemetry 1.1.0

Extensions:
azure-devops 1.0.2

Dependencies:
msal 1.33.0b1
azure-mgmt-resource 23.3.0

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

Python (Linux) 3.12.10 (main, Jun 24 2025, 10:15:18) [GCC 13.3.0]

Environment Summary

azure-cli 2.77.0

core 2.77.0
telemetry 1.1.0

Extensions:
azure-devops 1.0.2

Dependencies:
msal 1.34.0b1
azure-mgmt-resource 23.3.0

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

Python (Linux) 3.13.7 (main, Aug 26 2025, 08:47:19) [GCC 13.3.0]

Additional context

No response

Metadata

Metadata

Assignees

Labels

Auto-AssignAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamStorageaz storagebugThis 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

Relationships

None yet

Development

No branches or pull requests

Issue actions