Published on

Upload directory to Azure Storage using AzCopy in linux


Linux Azcopy directory


Recently I was in a situation where I need to copy multiple directories in to Azure storage. So, following is the steps I followed to copy into azure storage. Normally I use azcopy when it comes to copy files to azure storage.

Install AzCopy on Linux

#Download AzCopy
#Expand Archive
tar -xvf downloadazcopy-v10-linux
#(Optional) Remove existing AzCopy version
sudo rm /usr/bin/azcopy
#Move AzCopy to the destination you want to store it
sudo cp ./azcopy_linux_amd64_*/azcopy /usr/bin/

Authenticate AzCopy

When it comes to authenticate Azcopy we have two options as below. I picked the authenticate vis SAS token

Using Azure AD

By using Azure Active Directory, we can provide credentials once instead of having to append SAS token each command.


Using SAS token

I picked the SAS token and used the command as below.

By running below command which uses SAS token will copy directory to Azure storage.

azcopy copy "/home/app/public_html/storage/documents" "" --recursive=true