Azure-cli: storage blob upload-batch fails with InvalidQueryParameterValue on Ubuntu

Created on 2 Aug 2019  路  6Comments  路  Source: Azure/azure-cli

az feedback auto-generates most of the information requested below, as of CLI version 2.0.70

Describe the bug
When running command like this - on Ubuntu 16.04.6 LTS:

az storage blob upload-batch -d "$web" --source /home/dev/build-agent/_work/2/app --account-name mystorage

I receive InvalidQueryParameterValue error like this:

ERROR: The command failed with an unexpected error. Here is the traceback: | 聽
-- | --
聽
聽 | 聽 | 聽
聽 | ERROR: Value for one of the query parameters specified in the request URI is invalid. ErrorCode: InvalidQueryParameterValue | 聽
聽 | <?xml version="1.0" encoding="utf-8"?><Error><Code>InvalidQueryParameterValue</Code><Message>Value for one of the query parameters specified in the request URI is invalid. | 聽
聽 | RequestId:b9989976-d01e-004d-144b-491b3a000000 | 聽
聽 | Time:2019-08-02T15:58:45.4638442Z</Message><QueryParameterName>comp</QueryParameterName><QueryParameterValue /><Reason /></Error> | 聽
聽 | Traceback (most recent call last): | 聽
聽 | File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 206, in invoke | 聽
聽 | cmd_result = self.invocation.execute(args) | 聽
聽 | File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 603, in execute | 聽
聽 | raise ex | 聽
聽 | File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 661, in _run_jobs_serially | 聽
聽 | results.append(self._run_job(expanded_arg, cmd_copy)) | 聽
聽 | File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 652, in _run_job | 聽
聽 | cmd_copy.exception_handler(ex) | 聽
聽 | File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/__init__.py", line 248, in new_handler | 聽
聽 | handler(ex) | 聽
聽 | File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/__init__.py", line 191, in handler | 聽
聽 | raise ex | 聽
聽 | File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 631, in _run_job | 聽
聽 | result = cmd_copy(params) | 聽
聽 | File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 305, in __call__ | 聽
聽 | return self.handler(*args, **kwargs) | 聽
聽 | File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 485, in default_command_handler | 聽
聽 | return op(**command_args) | 聽
聽 | File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/operations/blob.py", line 271, in storage_blob_upload_batch | 聽
聽 | if_none_match=if_none_match, timeout=timeout) | 聽
聽 | File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/util.py", line 218, in wrapper | 聽
聽 | return True, func(*args, **kwargs) | 聽
聽 | File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/operations/blob.py", line 247, in _upload_blob | 聽
聽 | return upload_blob(*args, **kwargs) | 聽
聽 | File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/operations/blob.py", line 360, in upload_blob | 聽
聽 | return type_func[blob_type]() | 聽
聽 | File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/operations/blob.py", line 353, in upload_block_blob | 聽
聽 | return client.create_blob_from_path(**create_blob_args) | 聽
聽 | File "/opt/az/lib/python3.6/site-packages/azure/multiapi/storage/v2018_11_09/blob/blockblobservice.py", line 470, in create_blob_from_path | 聽
聽 | timeout=timeout) | 聽
聽 | File "/opt/az/lib/python3.6/site-packages/azure/multiapi/storage/v2018_11_09/blob/blockblobservice.py", line 589, in create_blob_from_stream | 聽
聽 | timeout=timeout) | 聽
聽 | File "/opt/az/lib/python3.6/site-packages/azure/multiapi/storage/v2018_11_09/blob/blockblobservice.py", line 1108, in _put_blob | 聽
聽 | return self._perform_request(request, _parse_base_properties) | 聽
聽 | File "/opt/az/lib/python3.6/site-packages/azure/multiapi/storage/v2018_11_09/common/storageclient.py", line 430, in _perform_request | 聽
聽 | raise ex | 聽
聽 | File "/opt/az/lib/python3.6/site-packages/azure/multiapi/storage/v2018_11_09/common/storageclient.py", line 358, in _perform_request | 聽
聽 | raise ex | 聽
聽 | File "/opt/az/lib/python3.6/site-packages/azure/multiapi/storage/v2018_11_09/common/storageclient.py", line 344, in _perform_request | 聽
聽 | HTTPError(response.status, response.message, response.headers, response.body)) | 聽
聽 | File "/opt/az/lib/python3.6/site-packages/azure/multiapi/storage/v2018_11_09/common/_error.py", line 115, in _http_error_handler | 聽
聽 | raise ex | 聽
聽 | azure.common.AzureHttpError: Value for one of the query parameters specified in the request URI is invalid. ErrorCode: InvalidQueryParameterValue | 聽
聽 | <?xml version="1.0" encoding="utf-8"?><Error><Code>InvalidQueryParameterValue</Code><Message>Value for one of the query parameters specified in the request URI is invalid. | 聽
聽 | RequestId:b9989976-d01e-004d-144b-491b3a000000 | 聽
聽 | Time:2019-08-02T15:58:45.4638442Z</Message><QueryParameterName>comp</QueryParameterName><QueryParameterValue /><Reason /></Error>

I had the same error on 2.0.69 version. (After getting this error, I upgraded to 2.0.70 but I didn't help me.
When I run this from Windows 10 and 2.0.68 version - it works, all files are being uploaded.

To Reproduce

  1. Create storage account.
  2. Set it to serve static pages with command:
    az storage blob service-properties update --account-name <storge-name> --static-website --index-document index.html --404-document index.html
  3. Then try to upload a SPA application dist files with above-metnioned command.

Expected behavior
Expect to have this working on Ubuntu machine too.

Environment summary
Problem occurs on VM with Ubuntu 16.04.6 LTS hosted on Azure. Azure CLI was installed there with curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

Additional context
The same storage and the same folder-to-upload works on 2.0.68 & Windows 10 - what is installed on my workstation.

Storage

Most helpful comment

I had the same problem. I think the issue is that you are writing "$web" instead of '$web', so the name is treated as a variable. This change helped me at least, but error message definitely needs some improvement.

All 6 comments

@robert-skarzycki

  1. "$web" is not a valid container name or container url. Are you sure it works for 2.0.68? Or you want to pass the value of web variable? If you use $web variable, please confirm you have set $web value with a valid container name. You can check $web value using echo $web
  2. curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash will install the latest version. You can find the installed version using az --version

@Juliehzl - regarding $web - I was following guidelines like this: https://kvaes.wordpress.com/2018/10/24/using-azure-devops-to-deploy-your-static-webpage-spa-to-azure-storage/ - I'd like to deploy SPA web app into storage and serve it directly from there. So this is not a variable, but - I guess - some keyword for Azure to make it "servable" as web page. Am I right?

If $web isn't a variable, for az storage blob upload-batch command, $ cannot be used as an destination name, besides when pointing to a variable, which is the reason you have InvalidQueryParameterValue error. Please change your destination name to a valid one.

@robert-skarzycki what about your problem now?

I had the same problem. I think the issue is that you are writing "$web" instead of '$web', so the name is treated as a variable. This change helped me at least, but error message definitely needs some improvement.

@loomchild - it helped me too, great thanks!

Was this page helpful?
0 / 5 - 0 ratings