skip to Main Content

az storage blob upload-batch -d "$web" -s

When I run this command I encounter an error " argument –source/-s: expected one argument "

What would I add here? For the source how can I get the path-to-directory ?

I have tried this command "az storage blob upload-batch -d "$web" -s /home/cloud/index.html"

2

Answers


  1. I agree with @Jayendran, You can use this command:

    az storage blob upload-batch -d mycontainer --account-name mystorageaccount --account-key 00000000 -s <path-to-directory>

    make sure to use you are mentioning the file path of the file in quote
    like this `"/home/cloud/index.html"

    Login or Signup to reply.
  2. What should I add here? For the source, how can I get the path-to-directory?

    az storage blob upload-batch command is used to upload multiple files to Azure blob storage.

    Command:

    az storage blob upload-batch -d <Your-container-name> --account-name <Your-account-name> --account-key "<Your-storage-account-key>" -s "/home/cloud/"
    

    You need to mention the path up to the directory only in the source parameter.

    Output:

    In my environment, the above command was executed and uploaded multiple files to the Azure blob storage.

    PS /home/xxx> az storage blob upload-batch -d xxx --account-name xxx --account-key xxxxx -s "/home/xxxx/dxxx"
    The behavior of this command has been altered by the following extension: storage-blob-preview
    Finished[#############################################################]  100.0000%
    [
      {
        "Blob": "https://xxx.blob.core.windows.net/",
        "Last Modified": "2024-01-05T06:33:43+00:00",
        "Type": "application/pdf",
        "eTag": ""0x8DC0DB84344DF01""
      },
      {
        "Blob": "https://xxxx.blob.core.windows.net/",
        "Last Modified": "2024-01-05T06:33:43+00:00",
        "Type": "text/plain",
        "eTag": ""0x8DC0DB8436A89F2""
      },
      {
        "Blob": "https://xxxx.blob.core.windows.net/",
        "Last Modified": "2024-01-05T06:33:43+00:00",
        "Type": "text/csv",
        "eTag": ""0x8DC0DB84390D102""
      },
      {
        "Blob": "https://xxx.blob.core.windows.net/",
        "Last Modified": "2024-01-05T06:33:44+00:00",
        "Type": "text/csv",
        "eTag": ""0x8DC0DB843B20FD1""
      },
      {
        "Blob": "https://xxx.blob.core.windows.net/",
        "Last Modified": "2024-01-05T06:33:44+00:00",
        "Type": "text/csv",
        "eTag": ""0x8DC0DB843D34E8D""
      },
      {
        "Blob": "https://xxx.blob.core.windows.net/",
        "Last Modified": "2024-01-05T06:33:47+00:00",
        "Type": "video/mp4",
        "eTag": ""0x8DC0DB84572911F""
      }
    

    Enter image description here

    Portal:
    Enter image description here

    If you need to upload a particular blob, you can simply use the below command.

    Command and output:

    PS /home/xxxx/demo> az storage blob upload --account-name xxx --account-key xxx --container-name xxx --file "/home/xxxx/demo/sample.txt" --name "demo.txt"
    The behavior of this command has been altered by the following extension: storage-blob-preview
    Finished[#############################################################]  100.0000%
    {
      "client_request_id": "91xxx",
      "content_md5": "xxx",
      "date": "2024-01-05T06:42:18+00:00",
      "encryption_key_sha256": null,
      "encryption_scope": null,
      "etag": ""0x8DC0DB97664024D"",
      "last_modified": "2024-01-05T06:42:18+00:00",
      "request_id": "xxxx",
      "request_server_encrypted": true,
      "version": "2020-10-02",
      "version_id": "2xxx"
    }
    

    Enter image description here

    Portal:
    Enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search