Files
runner-images/images/windows/scripts/build/Install-AzureCli.ps1
T

30 lines
1.1 KiB
PowerShell
Raw Normal View History

################################################################################
## File: Install-AzureCli.ps1
## Desc: Install and warm-up Azure CLI
################################################################################
2023-10-05 15:03:58 +02:00
Write-Host 'Install the latest Azure CLI release'
$azureCliConfigPath = 'C:\azureCli'
# Store azure-cli cache outside of the provisioning user's profile
2023-12-04 10:50:53 +01:00
[Environment]::SetEnvironmentVariable('AZURE_CONFIG_DIR', $azureCliConfigPath, "Machine")
$azureCliExtensionPath = Join-Path $env:CommonProgramFiles 'AzureCliExtensionDirectory'
2023-12-04 10:50:53 +01:00
New-Item -ItemType 'Directory' -Path $azureCliExtensionPath | Out-Null
[Environment]::SetEnvironmentVariable('AZURE_EXTENSION_DIR', $azureCliExtensionPath, "Machine")
2023-10-05 15:03:58 +02:00
Install-Binary -Type MSI `
-Url 'https://aka.ms/installazurecliwindowsx64' `
-ExpectedSignature 'C2048FB509F1C37A8C3E9EC6648118458AA01780'
2023-12-04 10:50:53 +01:00
Update-Environment
2023-10-05 15:03:58 +02:00
# Warm-up Azure CLI
Write-Host "Warmup 'az'"
az --help | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "Command 'az --help' failed"
2023-10-05 15:03:58 +02:00
}
Invoke-PesterTests -TestFile 'CLI.Tools' -TestName 'Azure CLI'