diff --git a/build.psm1 b/build.psm1 index 04298c61b4..c57eab8aa1 100644 --- a/build.psm1 +++ b/build.psm1 @@ -3364,13 +3364,15 @@ function Install-AzCopy { return } - $destination = "$env:TEMP\azcopy81.msi" - Invoke-WebRequest "https://aka.ms/downloadazcopy" -OutFile $destination - Start-Process -FilePath $destination -ArgumentList "/quiet" -Wait + $destination = "$env:TEMP\azcopy10.zip" + $downloadLocation = (Invoke-WebRequest -Uri https://aka.ms/downloadazcopy-v10-windows -MaximumRedirection 0 -ErrorAction SilentlyContinue -SkipHttpErrorCheck).headers.location + + Invoke-WebRequest -Uri $downloadLocation -OutFile $destination -Verbose + Expand-archive -Path $destination -Destinationpath '$(Agent.ToolsDirectory)\azcopy10' } function Find-AzCopy { - $searchPaths = @("C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy\AzCopy.exe", "C:\azcopy10\AzCopy.exe") + $searchPaths = @('$(Agent.ToolsDirectory)\azcopy10', "C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy\AzCopy.exe", "C:\azcopy10\AzCopy.exe") foreach ($filter in $searchPaths) { $azCopy = Get-ChildItem -Path $filter -Recurse -ErrorAction SilentlyContinue | Select-Object -ExpandProperty FullName -First 1 diff --git a/tools/releaseBuild/azureDevOps/templates/release-CreateGitHubDraft.yml b/tools/releaseBuild/azureDevOps/templates/release-CreateGitHubDraft.yml index 63a599d143..98b65a4c6f 100644 --- a/tools/releaseBuild/azureDevOps/templates/release-CreateGitHubDraft.yml +++ b/tools/releaseBuild/azureDevOps/templates/release-CreateGitHubDraft.yml @@ -6,6 +6,12 @@ steps: - template: release-SetReleaseTagAndContainerName.yml +- pwsh: | + Import-module '$(BUILD.SOURCESDIRECTORY)/build.psm1' + Install-AzCopy + displayName: Install AzCopy + retryCountOnTaskFailure: 2 + - pwsh: | Import-module '$(BUILD.SOURCESDIRECTORY)/build.psm1' $azcopy = Find-AzCopy diff --git a/tools/releaseBuild/azureDevOps/templates/vpackReleaseJob.yml b/tools/releaseBuild/azureDevOps/templates/vpackReleaseJob.yml index b6e53e9923..738718a2cd 100644 --- a/tools/releaseBuild/azureDevOps/templates/vpackReleaseJob.yml +++ b/tools/releaseBuild/azureDevOps/templates/vpackReleaseJob.yml @@ -28,6 +28,12 @@ jobs: parameters: ReleaseTagVar: $(ReleaseTagVar) + - pwsh: | + Import-module '$(BUILD.SOURCESDIRECTORY)/build.psm1' + Install-AzCopy + displayName: Install AzCopy + retryCountOnTaskFailure: 2 + - pwsh: | Import-module '$(BUILD.SOURCESDIRECTORY)/build.psm1' $azcopy = Find-AzCopy