Search code examples
macosazureazure-cliazcopyazure-cli2

Azure CLI storage Batch Copy not working on mac Seira


I have an AzCopy command on windows that copies all blobs from a storage account to a local network drive and tests to make sure the file doesn't already exist before copying.

AzCopy /Source:https://storage.blob.core.windows.net/photos /Dest:C:\folder /SourceKey:xxxxxkeyxxxxxxx /S /XO /XN

This command is working perfectly. However i need to set up this same process on a mac. I have installed the Azure CLI tools and have created the following batch copy command. I have dryrun while i was testing

az storage blob copy start-batch \
--destination-container "/Volumes/Seagate Backup Plus Drive/folder" \
—-source-account-key xxxxkeyxxxx \
—-source-account-name storage \
—-source-uri https://storage.blob.core.windows.net/photos \
--dryrun

But i get the following error message

az: error: unrecognized arguments: Backup Plus Drive/New folder 
—-source-account-key xxxxkeyxxxx 
—-source-account-name storage 
—-source-uri https://storage.blob.core.windows.net/photos

I read here that you can use AzCopy through the Azure CLI. But when i tried it it said command not found.

I'm a complete Mac newbie and not sure what i am doing wrong. Any assistance is greatly appreciated.

This process also needs to be set up as a batch process for a non-tech person to be able to run. I haven't looked into this yet as wanted to get the copy working first.


Solution

  • There are two mistakes in your script.

    Firstly, Seagate Backup Plus Drive There are three spaces. When you use Azure CLi, you should use %20 to replace it. For example:

    /Volumes/Seagate%20Backup%20Plus%20Drive
    

    You could check it on Azure Portal.

    enter image description here

    Secondly, —-source-account-key xxxxkeyxxxx this is wrong. The correct format is --source-account-key xxxxkeyxxxx. If you look carefully, —- and -- are different.

    You also need replace —-source-account-name storage and —-source-uri https://storage.blob.core.windows.net/photos they are same mistake.