2021-04-27 01:27:45 +08:00
|
|
|
# Copyright (c) Microsoft Corporation.
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
2024-07-04 11:01:35 +08:00
|
|
|
param([string]$SasToken)
|
2021-04-27 01:27:45 +08:00
|
|
|
|
2024-07-04 11:01:35 +08:00
|
|
|
if (Test-Path "$PSScriptRoot/utility-prefix.ps1") {
|
|
|
|
. "$PSScriptRoot/utility-prefix.ps1"
|
|
|
|
}
|
2021-04-27 01:27:45 +08:00
|
|
|
|
2024-07-04 11:01:35 +08:00
|
|
|
[string]$PwshUrl
|
|
|
|
if ([string]::IsNullOrEmpty($SasToken)) {
|
2024-11-20 06:42:29 +08:00
|
|
|
Write-Host 'Downloading from the Internet'
|
|
|
|
$PwshUrl = 'https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/PowerShell-7.4.6-win-x64.msi'
|
2024-07-04 11:01:35 +08:00
|
|
|
} else {
|
2024-11-20 06:42:29 +08:00
|
|
|
Write-Host 'Downloading from vcpkgimageminting using SAS token'
|
2024-07-04 11:01:35 +08:00
|
|
|
$SasToken = $SasToken.Replace('"', '')
|
2024-11-20 06:42:29 +08:00
|
|
|
$PwshUrl = "https://vcpkgimageminting.blob.core.windows.net/assets/PowerShell-7.4.6-win-x64.msi?$SasToken"
|
2024-07-04 11:01:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
DownloadAndInstall -Url $PwshUrl -Name 'PowerShell Core' -Args @('/quiet', '/norestart')
|