-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Describe the bug
When passing a path with a prefixed / to the --source flag In git bash (Used in Azure pipelines on windows agent) az storage file upload-batch stalls and consumes more and more ram until it runs out and crashes.
Screenshot from my machine after about 20 sek. of running:

This is the command that makes it crash:
az storage file upload-batch --destination "$FILE_SHARE_URL" --source '.\Add-AppDevPackage.resources'/ --destination-path "/some/path" --account-key "$ACCOUNT_KEY" --debug
This one works as expected:
az storage file upload-batch --destination "$FILE_SHARE_URL" --source '.\Add-AppDevPackage.resources'/ --destination-path "some/path" --account-key "$ACCOUNT_KEY" --debug
The subtle difference being that the second one does not have a / prefixed to some/path. I noticed in the debug output that git bash expanded /some/path into C:/Program Files/Git/some/path. This is probably out of scope for this repo, however, an error message about the path being invalid should be put in place instead of increasing memory consumption until it crashes.
Related command
az storage file upload-batch
Errors
From pipeline without debug flag:
##[warning]Free memory is lower than 5%; Currently used: 95.90%
ERROR: The command failed with an unexpected error. Here is the traceback:
ERROR:
Traceback (most recent call last):
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 666, in execute
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 734, in _run_jobs_serially
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 726, in _run_job
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/storage/__init__.py", line 358, in new_handler
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/storage/__init__.py", line 357, in new_handler
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 703, in _run_job
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 336, in __call__
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 120, in handler
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/storage/operations/file.py", line 201, in storage_file_upload_batch
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/storage/operations/file.py", line 152, in _execute_in_parallel
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/storage/operations/file.py", line 152, in <genexpr>
File "concurrent\futures\_base.py", line 449, in result
File "concurrent\futures\_base.py", line 401, in __get_result
File "concurrent\futures\thread.py", line 59, in run
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/storage/operations/file.py", line 187, in _upload_action
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/storage/operations/file.py", line 441, in _make_directory_in_files_share
MemoryError
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
Issue script & Debug output
az storage file upload-batch --destination "$FILE_SHARE_URL" --source '.\Add-AppDevPackage.resources'/ --destination-path "/some/path" --account-key "$ACCOUNT_KEY" --debug
cli.knack.cli: Command arguments: ['storage', 'file', 'upload-batch', '--destination', 'FILESHARE_URL', '--source', '.\\Add-AppDevPackage.resources/', '--destination-path', 'C:/Program Files/Git/some/path', '--account-key', 'KEY', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
Enable VT mode.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x000001BFEB6544A0>, <function OutputProducer.on_global_arguments at 0x000001BFEBBF18A0>, <function CLIQuery.on_global_arguments at 0x000001BFEBC3B7E0>]
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.884 60 275
cli.azure.cli.core: Total (1) 0.884 60 275
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 file upload-batch
cli.azure.cli.core: Command table: storage file upload
cli.azure.cli.core: remaining : batch
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x000001BFEDBED080>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\Aron\.azure\commands\2025-09-19.19-39-52.storage_file_upload-batch.25672.log'.
az_command_data_logger: command args: storage file upload-batch --destination {} --source {} --destination-path {} --account-key {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x000001BFEE42E5C0>]
cli.azure.cli.core.profiles._shared: Traceback (most recent call last):
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/profiles/_shared.py", line 454, in _get_attr
File "importlib\__init__.py", line 88, in import_module
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'azure.mgmt.storage.blob'
cli.azure.cli.core.profiles._shared: Traceback (most recent call last):
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/profiles/_shared.py", line 454, in _get_attr
File "importlib\__init__.py", line 88, in import_module
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'azure.mgmt.storage.file'
cli.azure.cli.core.profiles._shared: Traceback (most recent call last):
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/profiles/_shared.py", line 454, in _get_attr
File "importlib\__init__.py", line 88, in import_module
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'azure.mgmt.storage.file'
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x000001BFEE458900>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x000001BFEE458AE0>, <function register_upcoming_breaking_change_info.<locals>.update_breaking_change_info at 0x000001BFEE458B80>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x000001BFEBBF1940>, <function CLIQuery.handle_query_parameter at 0x000001BFEBC3B880>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x000001BFEE4589A0>]
cli.azure.cli.command_modules.storage._validators: Try to get storage auth_mode value from environment variables or config file.
cli.azure.cli.command_modules.storage._validators: Try to get storage account value from environment variables or config file.
cli.azure.cli.command_modules.storage._validators: Try to get storage account_url value from environment variables or config file.
cli.azure.cli.command_modules.storage._validators: Try to get storage account value from environment variables or config file.
cli.azure.cli.command_modules.storage._validators: Try to get storage account_url value from environment variables or config file.
cli.azure.cli.command_modules.storage._validators: Try to get storage sas_token value from environment variables or config file.
Expected behavior
An error message to appear about the path being invalid instead of increasing memory consumption until it crashes.
Environment Summary
azure-cli 2.77.0
core 2.77.0
telemetry 1.1.0
Dependencies:
msal 1.34.0b1
azure-mgmt-resource 23.3.0
Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Config directory 'C:\Users\Aron.azure'
Extensions directory 'C:\Users\Aron.azure\cliextensions'
Python (Windows) 3.13.7 (tags/v3.13.7:bcee1c3, Aug 14 2025, 14:15:11) [MSC v.1944 64 bit (AMD64)]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Additional context
No response