Azure / azure-cli

Azure Command-Line Interface
MIT License
4.01k stars 2.98k forks source link

az storage blob download-batch fails with --sas-token #9293

Closed acl33 closed 5 years ago

acl33 commented 5 years ago

This is autogenerated. Please review and update as needed.

Describe the bug

az storage blob download-batch --sas-token fails whereas same with --account-key succeeds

Command Name az storage blob download-batch

Errors:

The specified resource does not exist. ErrorCode: ResourceNotFound
<?xml version="1.0" encoding="utf-8"?><Error><Code>ResourceNotFound</Code><Message>The specified resource does not exist.
RequestId:f635efb1-b01e-0074-0b23-019c1f000000
Time:2019-05-02T20:12:05.8062305Z</Message></Error>
Traceback (most recent call last):
pip-install-68v0_w99\knack\knack\cli.py, ln 206, in invoke
cli\core\commands\__init__.py, ln 523, in execute
...
<?xml version="1.0" encoding="utf-8"?><Error><Code>ResourceNotFound</Code><Message>The specified resource does not exist.
RequestId:f635efb1-b01e-0074-0b23-019c1f000000
Time:2019-05-02T20:12:05.8062305Z</Message></Error>

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

The command failed with an unexpected error. Here is the traceback:

cli.azure.cli.core.util : The specified resource does not exist. ErrorCode: ResourceNotFound <?xml version="1.0" encoding="utf-8"?>ResourceNotFoundThe specified resource does not exist. RequestId:00397697-b01e-0016-6d23-015e38000000 Time:2019-05-02T20:12:29.2988923Z Traceback (most recent call last): File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\knack\knack\cli.py", line 206, in invoke File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-core\azure\cli\core\commands__init.py", line 523, in execute File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-core\azure\cli\core\commands__init.py", line 581, in _run_jobs_serially File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-core\azure\cli\core\commands__init.py", line 572, in _run_job File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-storage\azure\cli\command_modules\storage__init.py", line 240, in new_handler File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-storage\azure\cli\command_modules\storage__init.py", line 183, in handler File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-core\azure\cli\core\commands__init.py", line 551, in _run_job File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-core\azure\cli\core\commands__init.py", line 289, in call__ File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-core\azure\cli\core__init__.py", line 453, in default_command_handler File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-storage\azure\cli\command_modules\storage\operations\blob.py", line 165, in storage_blob_download_batch File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-storage\azure\cli\command_modules\storage\util.py", line 24, in collect_blobs File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-multiapi-storage\azure\multiapi\storage\v2018_03_28\blob\baseblobservice.py", line 1247, in list_blobs File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-multiapi-storage\azure\multiapi\storage\v2018_03_28\blob\baseblobservice.py", line 1322, in _list_blobs File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-multiapi-storage\azure\multiapi\storage\v2018_03_28\common\storageclient.py", line 381, in _perform_request File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-multiapi-storage\azure\multiapi\storage\v2018_03_28\common\storageclient.py", line 306, in _perform_request File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-multiapi-storage\azure\multiapi\storage\v2018_03_28\common\storageclient.py", line 292, in _perform_request File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-multiapi-storage\azure\multiapi\storage\v2018_03_28\common_error.py", line 115, in _http_error_handler azure.common.AzureMissingResourceHttpError: The specified resource does not exist. ErrorCode: ResourceNotFound <?xml version="1.0" encoding="utf-8"?>ResourceNotFoundThe specified resource does not exist. RequestId:00397697-b01e-0016-6d23-015e38000000 Time:2019-05-02T20:12:29.2988923Z The specified resource does not exist. ErrorCode: ResourceNotFound <?xml version="1.0" encoding="utf-8"?>ResourceNotFoundThe specified resource does not exist. RequestId:00397697-b01e-0016-6d23-015e38000000 Time:2019-05-02T20:12:29.2988923Z Traceback (most recent call last): File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\knack\knack\cli.py", line 206, in invoke File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-core\azure\cli\core\commands\init__.py", line 523, in execute File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-core\azure\cli\core\commands\init.py", line 581, in _run_jobs_serially File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-core\azure\cli\core\commands\init.py", line 572, in _run_job File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-storage\azure\cli\command_modules\storage\init__.py", line 240, in new_handler File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-storage\azure\cli\command_modules\storage\init__.py", line 183, in handler File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-core\azure\cli\core\commands\init__.py", line 551, in _run_job File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-core\azure\cli\core\commands\init.py", line 289, in call__ File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-core\azure\cli\core\init__.py", line 453, in default_command_handler File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-storage\azure\cli\command_modules\storage\operations\blob.py", line 165, in storage_blob_download_batch File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-storage\azure\cli\command_modules\storage\util.py", line 24, in collect_blobs File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-multiapi-storage\azure\multiapi\storage\v2018_03_28\blob\baseblobservice.py", line 1247, in list_blobs File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-multiapi-storage\azure\multiapi\storage\v2018_03_28\blob\baseblobservice.py", line 1322, in _list_blobs File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-multiapi-storage\azure\multiapi\storage\v2018_03_28\common\storageclient.py", line 381, in _perform_request File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-multiapi-storage\azure\multiapi\storage\v2018_03_28\common\storageclient.py", line 306, in _perform_request File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-multiapi-storage\azure\multiapi\storage\v2018_03_28\common\storageclient.py", line 292, in _perform_request File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-multiapi-storage\azure\multiapi\storage\v2018_03_28\common_error.py", line 115, in _http_error_handler azure.common.AzureMissingResourceHttpError: The specified resource does not exist. ErrorCode: ResourceNotFound <?xml version="1.0" encoding="utf-8"?>ResourceNotFoundThe specified resource does not exist. RequestId:00397697-b01e-0016-6d23-015e38000000 Time:2019-05-02T20:12:29.2988923Z cli.azure.cli.core.util : To open an issue, please run: 'az feedback'

To open an issue, please run: 'az feedback' az_command_data_logger : exit code: 1 telemetry.save : Save telemetry record of length 2508 in cache telemetry.check : Negative: The C:\Users\allawr.azure\telemetry.txt was modified at 2019-05-02 21:12:07.421643, which in less than 600.000000 s command ran in 1.040 seconds. 'sp' is not recognized as an internal or external command, operable program or batch file. 'sv' is not recognized as an internal or external command, operable program or batch file. 'sr' is not recognized as an internal or external command, operable program or batch file. 'sig' is not recognized as an internal or external command, operable program or batch file.

The "Command arguments" are clearly wrong, the rest of the sas having been lost. I note that if I put any of the other arguments to 'az storage blob download-batch' after the --sas-token, they don't show up in the list (putting --debug after --sas-token doesn't give debug output, either). Fearing maybe this was user error, I tried escaping the &'s in my SAS token with both ` (Powershell) and \ (python), to no avail, also using [System.Web.HttpUtility]::UrlEncode($sas), this printed a full (encoded) SAS string in the command-line arguments list, but still ResourceNotFound.

## Expected Behavior
Download the files, or list with `--dryrun`, just as it did with `--account-key` rather than `--sas-token`
## Environment Summary

Windows-10-10.0.17763-SP0 Python 3.6.6 Shell: powershell.exe

azure-cli 2.0.63

## Additional Context

$PSVersionTable.PSVersion

Major Minor Build Revision


5 1 17763 316


<!--Please don't remove this:-->
<!--auto-generated-->
acl33 commented 5 years ago

Ok, seems I need the $sas to contain double-quotes as first and last characters of the string.