Tuesday, February 4, 2020

Get started with Azure AzCopy

Get started with Azure AzCopy

AZCopy: https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-v10

Login to Azure portal 'https://portal.azure.com/' and create 'storage account'.

after create 'storage account' create assign role assignments.

access control (IAM) => Rolse assignments => Add => Add role assignment => select role as  'Storage Blob Data Container' => select user => click save button.

Go to Containers => Create new container => give container name as 'photos2'

download azcopy exe file from below url:

save azcopy.exe file in C:\\ folder to run.

run below command in azcopy tool.

c:\\azcopy login

Create a source folder and add some images to upload azure blob storage as below screen.

copy azure blob container endpoint from azure portal as shown below screen.

run azcopy tool to copy images from source to azure portal blob. use 'recursive' if folder have sub folder.

azcopy copy "C:\SP\Source_Images\*" "https://rg1storageaccname2.blob.core.windows.net/photos2" --recursive=true

go to azure portal blob container and refresh, check images are uploaded. 

now copy from blob container to another blob container using 'Shared Access Signature (SAS)'

for that first create 'Shared Access Signature (SAS)' as shown below screen.

go to second container and create role assignment to copy from source container using azcopy tool.

run below command to copy from source blob container to destination blob container using Shared Access Signature (SAS)'

source blob container: https://rg1storageaccname2.blob.core.windows.net/photos2
destination blob container: https://rg1storageaccname1.blob.core.windows.net/photos1

azcopy copy "https://rg1storageaccname2.blob.core.windows.net/photos2/?sv=2019-02-02&ss=bfqt&srt=sco&sp=rwdlacup&se=2020-02-04T21:59:57Z&st=2020-02-04T13:59:57Z&spr=https&sig=bZRckvvjt48RlJUuNDAqmd9v4yUGfW8Nuh9BkoclfEU=" "https://rg1storageaccname1.blob.core.windows.net/photos1" --recursive=true

check in destination blob container images uploaded. 

1 comment: