Search code examples
azure-blob-storageazure-cli

Download a file from Azure Blob File Storage


I have a uri of this form:

abfss://feed-pipeline-workspace@my-company-dev.dfs.core.windows.net/myname/1/staging-snapshot-repo/form/Fulfillment/2022/01/02/snapshot-form-Fulfillment-20220102_000000.parquet

How can I access/download this using a command line tool e.g. az storage fs file download ? I am able to use az storage fs file upload but not sure how to piece together download. Any other bash-compatible tool or even ms.portal.azure.com approach would also be helpful.

The attempt at using the az cli is this

az storage fs file download --path myname/1/staging-snapshot-repo/form/Fulfillment/2022/01/02/snapshot-form-Fulfillment-20220102_000000.parquet  
  --account-name feed-pipeline-workspace --share-name myshare  
  -f blob

This gives:

unrecognized arguments: --share-name feed-pipeline-workspace

That is against the documents and examples, in which either --share-name or -s are valid ( i tried both and they both fail). Also i don't know what are the valid file-types for the -f argument

Note: there is no container parameter and so how is it to be specified?


Solution

  • unrecognized arguments: --share-name feed-pipeline-workspace

    The error states it doesn't has --share-name in the az storage fs file download command.

    You can follow this MS-Docs to download the file from Azure storage.

    Command:

    az storage fs file download -p dir/a.txt -d test/edit.txt -f fsname --account-name myadlsaccount --account-key 0000-0000
    

    Here -f is the filesystem(container)

    Output:

    enter image description here

    Downloaded file: enter image description here