Quick script to update AzCopy to the latest version.
This sample will download the latest version of AzCopy and place it in the C:\Azcopy folder. If you need to go back to a specific version, the previous versions will also be archived.
$root = "C:\azcopy"
$path = "$root\temp"
If(!(test-path -PathType container $path))
{
New-Item -ItemType Directory -Path $path
}
$getfilename = (Invoke-WebRequest -Uri https://aka.ms/downloadazcopy-v10-windows -MaximumRedirection 0 -ErrorAction SilentlyContinue -UseBasicParsing).headers.location
$outputFile = Split-Path $getfilename -leaf
(Invoke-WebRequest -Uri https://aka.ms/downloadazcopy-v10-windows -OutFile "$($path)\$($outputFile)" -ErrorAction SilentlyContinue)
Expand-archive -Path "$($path)\$($outputFile)" -DestinationPath "$($root)" -Force
$outputdir = [io.path]::GetFileNameWithoutExtension("$($path)\$($outputFile)")
Copy-Item "$($root)\$($outputdir)\azcopy.exe" -destination "c:\azcopy\"