AZ Copy Question RRS feed

  • Question

  • Hi,

    I would like a way to call AZ Copy from MS Access VBA and pass the required file name parameters to download or upload a file from/to Azure Storage, is this possible? If not is it possible to do from a Powershell script?



    Friday, February 10, 2017 2:27 AM

All replies

  • Hi Tony,

    since AzCopy is just a commandline utility, you can call it from whatever scripting language you like. Using VBA you can do something like this:

    Call Shell("C:\Path\To\AzCopy.exe /Source" & strSource & " /Dest:" & strDestination, vbNormalFocus)

    In PowerShell, you can call the AzCopy utility directly, or using Start-Process:

    Start-Process -FilePath C:\Path\To\AzCopy.exe -ArgumentList "/Source:$MySource /Dest:$MyDest" -Wait

    If needed, you could even use the Start-AzureStorageBlobCopy or Start-AzureStorageFileCopy. 

    Floris van der Ploeg - www.florisvanderploeg.com

    If my post was helpfull, remember to click the "Propose as answer" button.

    • Proposed as answer by Md Shihab Tuesday, February 21, 2017 7:40 AM
    Friday, February 10, 2017 8:20 AM
  • Thanks for the response, can parameters also be passed from VBA to AzCopy to specify the file name to upload/download also?



    Sunday, February 12, 2017 8:50 PM
  • Hi,

    By any chance could someone provide the code to call and pass parameters to AZCopy (Azure Storage Command Line) from MS Access VBA.  I would just like a line of code which can call AZ Copy along with the key and file name to call to upload/download (this can be passed as a variable).



    • Merged by Md Shihab Tuesday, February 21, 2017 9:13 AM Same question
    Monday, February 20, 2017 7:56 PM
  • In PowerShell, you can use following  cmdelts to upload/download Files to Azure Storage Blob/File.


    You can see more details for how to use the Azure Storage PowerShell cmdelts in https://docs.microsoft.com/en-us/azure/storage/storage-powershell-guide-full#how-to-manage-azure-blobs

    To specify the file name to upload/download in AzCopy:

    AzCopy transfer target is a folder instead of a file, so if you want to transfer single file, you need to specify the file name in "/Pattern" parameter. And /Source /Dest should be the source and destination folder. For more about how to use AzCopy, please see https://docs.microsoft.com/en-us/azure/storage/storage-use-azcopy

    Tuesday, February 21, 2017 1:57 AM