AZCopy-- How to copy files from Azure Storage Blob Container to on-premises local storage drive and folder

 This article will describe about how to copy .bak file or .BACPAC file from Azure Blob Container to your on premises local drive and folder. Here I am only describing about only the command which can be used to fulfil our copy request which AZCopy.  This AZCopy is a command line utility which you can download from the mentioned URL. After you download this to a specific drive and folder you to run this from the command prompt(CMD). Before that we need these things.

1) Create a Azure SQL Database and take the backup to Azure Storage blob container. Once the file ready under azure storage you can run AZCopy command from your on-premises server and you can bring to on premises drive and folder. If you see the image below I am need to give READ,ADD,CREATE,WRITE  permissions based on the requirement. Once you give this permissions and after generating SAS please run AZCopy command from the command prompt of your on premises server.  Please see the last image.

And the approach is same for Azure SQL Managed instance as well.





Now we need to generate SAS( Shared Access Signature) to that particular file here it is backup file and after generating SAS then we can download the that particular backup file to our on premises local drive and folder






The below script will tell you how to copy to local server from Azure Blob storage container. You need t run this command from the folder or drive to which you have downloaded AzCopy  command line utility.  Here the source is "Azure blob container" and destination is " D:\Test" path




And the result shown as 

and the backup file available in


The below azcopy command was generated by "Azure Storage Explorer". This is a tool like SSMS and This is generated the AZCOPY command script. If you want you can also upload files to Azure Blob container with Azure Storage explorer too. However I am providing information about AZCopy command Here. If you copy the conent it will comes in multiple lines and you need to bring to single line and paste it Pwowershell after you type AZ command.
$env:AZCOPY_CRED_TYPE = "Anonymous";$env:AZCOPY_CONCURRENCY_VALUE = "AUTO";./azcopy.exe copy "D:\Backup\RAMESH$MSSQL2016\AdventureWorks2008R2\FULL\RAMESH$MSSQL2016_AdventureWorks2008R2_FULL_20231112_013107.bak" "https://mamilstorage159753.blob.core.windows.net/mamillapallicontainer/RAMESH%24MSSQL2016_AdventureWorks2008R2_FULL_20231112_013107.bak?sv=2022-11-02&ss=bfqt&srt=sco&sp=rwdlacupiytfx&se=2024-03-05T16%3A24%3A26Z&st=2024-03-05T08%3A24%3A26Z&spr=https&sig=Pfnsspe1vQAnBcuRVp%2BTkWfR9RWO54ahPpNtO6B7Oo4%3D" --overwrite=prompt --from-to=LocalBlob --blob-type Detect --follow-symlinks --put-md5 --follow-symlinks --disable-auto-decoding=false --recursive --log-level=INFO;$env:AZCOPY_CRED_TYPE = "";$env:AZCOPY_CONCURRENCY_VALUE = "";

Comments

Popular posts from this blog

Configuring Always on setup in Microsoft Azure.