mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Add install az copy
This commit is contained in:
+6
-4
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user