question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Misbehaving pattern option in azure storage blob download-batch command when there is a local directory with the same name as that of the blob being used in command

See original GitHub issue

Describe the bug I have a blob in the container. I have a local directory which has the same name. When I run download-batch command with pattern option as “blob_name/*”, it is expanding the command options with the files in the local directory and failing.

To Reproduce Create a directory locally test_pattern with multiple files file1 and file2 in it. Upload a blob with the same name test_pattern. Then try to download using the following command with pattern option from the path where local directory exists. az storage blob download-batch -d . --pattern test_pattern/* -s <container>

Error: cli.azure.cli.core.parser : az: error: unrecognized arguments: test_pattern/file2 az: error: unrecognized arguments: test_pattern/file2

Debug message: Command arguments: [‘storage’, ‘blob’, ‘download-batch’, ‘-d’, ‘.’, ‘–pattern’, ’ test_pattern/file1’, ’ test_pattern/file2’, ‘-s’, ‘mlebarstoragecontainer’, ‘–debug’]

Expected behavior It should not care about the local directory, it should just find a blob with the given name in the container and download locally or throw a proper warning/error.

Environment summary

Install Method: pip CLI version: azure-cli: 2.0.60 * storage: 2.4.2 OS version: Ubuntu Docker Container Shell Type: bash

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mlatharacommented, Dec 5, 2019

I had the same issue. @raviteja22 was on the right track that the issue is bash expands the glob pattern and passes that on to az cli – but the issue doesn’t have anything to do with blob/directory names. AZ CLI expects to see the glob pattern, but only see the expanded filenames that fit the pattern instead. Adding a backslash before the glob (maybe quotes would work as well?) fixes the problem. Something like:

az storage blob download-batch -d . --pattern test_pattern/\* -s mlebarstoragecontainer
0reactions
tylerjgarlandcommented, Oct 6, 2020

I had the same issue. @raviteja22 was on the right track that the issue is bash expands the glob pattern and passes that on to az cli – but the issue doesn’t have anything to do with blob/directory names. AZ CLI expects to see the glob pattern, but only see the expanded filenames that fit the pattern instead. Adding a backslash before the glob (maybe quotes would work as well?) fixes the problem. Something like:

az storage blob download-batch -d . --pattern test_pattern/\* -s mlebarstoragecontainer

Thanks, you helped me solve my issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

az storage blob | Microsoft Learn
Upload files from a local directory to a blob container. az storage blob ... If a large number of storage commands are executed...
Read more >
Manage block blobs with Azure CLI - Storage - Microsoft Learn
To recursively download multiple blobs from a storage container, use the az storage blob download-batch command. This command supports Unix ...
Read more >
Download blobs from Azure Blob Storage by using AzCopy v10
You can download blobs and directories from Blob storage by using the AzCopy v10 ... Download a blob by using the azcopy copy...
Read more >
I am getting failures when trying to download a blob from ...
I am running this command on RHEL8 vm. az storage blob download-batch -d "/tmp/" --pattern "openldap-2.6.0.tgz" -s "binaries" --account-name ...
Read more >
Quickstart: Create, download, and list blobs with Azure CLI
You can use it in your browser with Azure Cloud Shell. ... Azure CLI commands for data operations against Blob storage support the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found