AZCopy : Upload and Download files from or to Azure Storage account using AZcopy
Upload and Download files from or to Azure Storage account using AZcopy:
AzCopy is a command-line utility used to upload and download files to or from a storage account .
Create a storage account and Create a container.
Select the Storage account >IAM> Grant “Storage blob data Contributor” and “Storage blob data Owner” access.
Download the AZcopy executable files based on your Operating system (Windows/ Linux) from Microsoft site.Upload the executable AZcopy file and upload in Azure Storage fileshare
To access the AZcopy file go to the file share path you have mounted on the system.
Open the Bash shell and access the file:
Windows : Extract the azcopy_windows_amd64_10.13.0.zip
Linux :To extract the file use tar –xvzf azcopy_linux_amd64_10.13.0.tar.gz
Upload a file to Storage account :
Login to Azcopy :
Azcopy login:
Use azcopy copy to upload a file:
Command : azcopy copy “file path” “container URL”
Example :azcopy copy 'C:\path\reports.txt' 'https://mystorageaccount.blob.core.windows.net/path/reports.txt'
Upload multiple files by using a symbol (*) in the file path or file name.
For example: 'C:\path\*.txt', or C:\path*\*.txt
Upload a Directory:
azcopy copy 'C:\path' 'https://mystorageaccount.blob.core.windows.net/path' –recursive
Upload a Directory Contents:
azcopy copy 'C:\path\*' 'https://mystorageaccount.dfs.core.windows.net/path/newblob'
Download a file using Azcopy:
azcopy copy 'https://mystorageaccount.dfs.core.windows.net/mycontainer/myTextFile.txt' 'C:\ path\reports.txt'
Download a Directory:
azcopy copy 'https://mystorageaccount.dfs.core.windows.net/path/newblob' 'C:\path' --recursive
Upload a Directory Contents:
azcopy copy 'https://mystorageaccount.blob.core.windows.net/path/newblob/*' 'C:\path'
Upload Files using SAS Token:
AZcopy using Shared access signature:
Go to Storage account >SAS > Generate SAS & Connection String >Copy the SAS token
Logout from Azcopy login : azcopy logout
azcopy copy 'C:\path\reports.txt' 'https://mystorageaccount.blob.core.windows.net/path/reports.txt(addSAS token here)'
Download files using SAS token :
azcopy copy 'https://mystorageaccount.dfs.core.windows.net/mycontainer/myTextFile.txt(addSAS token here)' 'C:\ path\reports.txt'
Thank you !!
Comments
Post a Comment