Upload files to Azure storage account securely from Ubuntu

Pre-requisites:

1 – Azcopy
2 – Storage account path

Step: 1

#Download azcopy to the ubuntu vm

wget "https://aka.ms/downloadazcopy-v10-linux" -O azcopy.tar.gz

#Example

root@LINUX01:~# wget "https://aka.ms/downloadazcopy-v10-linux" -O azcopy.tar.gz
--2022-12-18 11:04:01--  https://aka.ms/downloadazcopy-v10-linux
Resolving aka.ms (aka.ms)... 23.52.149.185
Connecting to aka.ms (aka.ms)|23.52.149.185|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://azcopyvnext.azureedge.net/release20221108/azcopy_linux_amd64_10.16.2.tar.gz [following]
--2022-12-18 11:04:01--  https://azcopyvnext.azureedge.net/release20221108/azcopy_linux_amd64_10.16.2.tar.gz
Resolving azcopyvnext.azureedge.net (azcopyvnext.azureedge.net)... 23.213.34.191, 23.213.34.169, 2600:1409:9800:21::17d8:93cb, ...
Connecting to azcopyvnext.azureedge.net (azcopyvnext.azureedge.net)|23.213.34.191|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12599077 (12M) [application/gzip]
Saving to: ‘azcopy.tar.gz’

azcopy.tar.gz                                                       100%[===================================================================================================================================================================>]  12.01M  --.-KB/s    in 0.06s

2022-12-18 11:04:01 (199 MB/s) - ‘azcopy.tar.gz’ saved [12599077/12599077]


Step: 2

#Untar the file

tar -zxvf azcopy.tar.gz

# Example output : 

root@LINUX01:~# tar -zxvf azcopy.tar.gz
azcopy_linux_amd64_10.16.2/
azcopy_linux_amd64_10.16.2/NOTICE.txt
azcopy_linux_amd64_10.16.2/azcopy

Step: 3

Create a container in a azure storage account where you would like to copy the files and copy the Blob SAS URL
Note : in then permissions section select required permissions to copy , delete files based on the requiremnet

Step: 4

#From the linux machine copy the files

./azcopy copy "/etc/sharedfiles/tehcloudwiki/abcd.txt" "https://thewikisharedfiles.blob.core.windows.net/sharedfiles?sp=racwl&st=2022-12-18T10:56:29Z&se=2022-12-18T18:56:29Z&sv=2021-06-08&sr=c&sig=CxxxxXXXXxxxxXXXXDSwq38qc2QroxxXX%3D"