In this post, we are going to copy a file from one container to another container in the same storage account.
- We create the storage account
- In storage account 1 we have already created two containers and upload a file to container 1
- We change the shared access signature for this storage account
- at the end we click on the button "Generate the connection string and SAS"
- We copy the following URL
- 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")
- this is the output of the command
- We validate the installation
- 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)
- We see the result of AzCopy
- We validate that the file has been copied to the other container