2

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.

Shui shengbao
  • 18,746
  • 3
  • 27
  • 45
Andrew
  • 311
  • 2
  • 13

1 Answers1

1

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.

Community
  • 1
  • 1
Shui shengbao
  • 18,746
  • 3
  • 27
  • 45
  • Thanks heaps @shengbao. Its running now but its saying "The requested URI does not represent any resource on the server" for the --destination-container. The destination container is a local harddrive and not another azure storage account. How can i get this script to copy down to a local drive? Or should i be doing this another way? – Andrew Dec 21 '17 at 03:12
  • @Andrew This command is used for copy file between storage account. If you want to upload file, you should use `az storage blob upload`. – Shui shengbao Dec 21 '17 at 03:14
  • No i wish to download from Azure – Andrew Dec 21 '17 at 03:16
  • You could use `az storage blob download`, see this [example](https://learn.microsoft.com/en-us/azure/storage/common/storage-azure-cli). – Shui shengbao Dec 21 '17 at 03:17
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/161670/discussion-between-shengbao-shui-msft-and-andrew). – Shui shengbao Dec 21 '17 at 05:09
  • Apologise for the delay in getting back to you.....Thanks heaps for your help.....I have the following code working....... az storage blob download-batch \ --destination //localdrive/photos \ --source https://storageName.blob.core.windows.net/photos \ --account-key xxxxkeyxxxx \ --account-name storageName \ – Andrew Jan 03 '18 at 04:31