Jesús García
Developing for Developers

Follow

Developing for Developers

Follow
Moving items between accounts or containers

Moving items between accounts or containers

Jesús García's photo
Jesús García
·Jun 28, 2022·

2 min read

In this post, we are going to copy a file from one container to another container in the same storage account.

  1. We create the storage account

image.png

  1. In storage account 1 we have already created two containers and upload a file to container 1

image.png

image.png

  1. We change the shared access signature for this storage account

image.png

  1. at the end we click on the button "Generate the connection string and SAS"

image.png

  1. We copy the following URL

image.png

  1. We must install AzCopy with the following command
#Download AzCopy
Invoke-WebRequest -Uri "https://aka.ms/downloadazcopy-v10-windows" -OutFile AzCopy.zip -UseBasicParsing

#Curl.exe option (Windows 10 Spring 2018 Update (or later))
curl.exe -L -o AzCopy.zip https://aka.ms/downloadazcopy-v10-windows

#Expand Archive
Expand-Archive ./AzCopy.zip ./AzCopy -Force

#Move AzCopy to the destination you want to store it
Get-ChildItem ./AzCopy/*/azcopy.exe | Move-Item -Destination "C:\Users\jesus\AzCopy\AzCopy.exe"

#Add your AzCopy path to the Windows environment PATH (C:\Users\jesus\AzCopy in this example), e.g., using PowerShell:
$userenv = [System.Environment]::GetEnvironmentVariable("Path", "User")
[System.Environment]::SetEnvironmentVariable("PATH", $userenv + ";C:\Users\jesus\AzCopy", "User")
  1. this is the output of the command

image.png

  1. We validate the installation

image.png

  1. To start the copy of the file from container1 to container2, we execute the following command

origin: is the URL of point5, we add "/container1/*" after the first part of the URL

(storageaccountjesus1.blob.core.windows.net/contenedor1/*?sv=2021-06-08&ss=bfqt&srt=sco&sp=rwdlacupitfx&se=2022-06-27T06:20:34Z&st=2022-06-26T22:20:34Z&spr=https&sig=aRIsEaQ%2BBj7mHasbfPmLO5lIcwuybJkpdSwNtES3JzA%3D)

destination: it's the same URL only we changed the URL of the container

(storageaccountjesus1.blob.core.windows.net/contenedor2/*?sv=2021-06-08&ss=bfqt&srt=sco&sp=rwdlacupitfx&se=2022-06-27T06:20:34Z&st=2022-06-26T22:20:34Z&spr=https&sig=aRIsEaQ%2BBj7mHasbfPmLO5lIcwuybJkpdSwNtES3JzA%3D)

  1. We see the result of AzCopy

image.png

  1. We validate that the file has been copied to the other container

image.png

Blue Nerd Gaming Sport and Esport Logo.png

 
Share this