Using azcopy to copy files

  • garryha

    SSC-Addicted

    Points: 417

    Im trying to copy the contents of my sql server backup .bak files to azure storage using azcopy.

    Im using this command in a batch .bat file -

    "C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy\AzCopy.exe" ^

    /Source:"I:\" /Dest:https://hmlrservicesstorage.****************************/ ^

    /DestKey:********************************************** /Pattern:"*.bak" /s /XO

    On the I drive there are two folders, one a normal folder and the other a network share.

    When I run the .bat file through a cmd prompt it runs fine copying all .bak files to the storage, yet when I run the same .bat file through a SQL Server gent job, using exactly the same .bat file it only copies the network share folder across and not the normal folders contents.

    I am copying from an Azure VM in the cloud to azure storage account.

    I cant understand why and would greatly appreciate any help on this.

  • Mr. Brian Gale

    SSC-Insane

    Points: 23075

    I have never used the tool azcopy.exe before, but as a thought, does your SQL Server Agent account have permission to the Azure site and have access to the files on I:\ drive?

    What I would try is start the command prompt up as the SQL Server Agent account and list the contents of the I drive.

    One way to do this would be to use this  (in a bat file):

    dir /s I:\ > c:\temp\IFiles.txt

    NOTE - make the folder C:\temp prior to running that.

    Run that bat file as a SQL agent job and check the contents of the file C:\temp\IFiles.txt.  Everything it lists is everything that the SQL Server Agent account can see.

    My guess is that one or more folders on I:\ are not accessible by the SQL Server Agent account.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply