2019-12-13 09:48:00 -05:00
|
|
|
################################################################################
|
|
|
|
|
## File: Install-AzureCli.ps1
|
2023-11-16 11:20:11 +01:00
|
|
|
## Desc: Install and warm-up Azure CLI
|
2019-12-13 09:48:00 -05:00
|
|
|
################################################################################
|
|
|
|
|
|
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")
|
|
|
|
|
|
2023-12-11 22:23:36 +01:00
|
|
|
$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
|
|
|
|
2023-11-22 15:14:08 +01:00
|
|
|
Install-Binary -Type MSI `
|
2023-12-11 22:23:36 +01:00
|
|
|
-Url 'https://aka.ms/installazurecliwindowsx64' `
|
2024-01-09 20:05:02 +01:00
|
|
|
-ExpectedSignature 'C2048FB509F1C37A8C3E9EC6648118458AA01780'
|
2019-12-13 09:48:00 -05:00
|
|
|
|
2023-12-04 10:50:53 +01:00
|
|
|
Update-Environment
|
2020-07-07 13:20:09 +03:00
|
|
|
|
2023-10-05 15:03:58 +02:00
|
|
|
# Warm-up Azure CLI
|
|
|
|
|
Write-Host "Warmup 'az'"
|
|
|
|
|
az --help | Out-Null
|
2023-10-06 11:54:51 +02:00
|
|
|
if ($LASTEXITCODE -ne 0) {
|
2023-12-11 22:23:36 +01:00
|
|
|
throw "Command 'az --help' failed"
|
2023-10-05 15:03:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Invoke-PesterTests -TestFile 'CLI.Tools' -TestName 'Azure CLI'
|