-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
Copy pathInstall-AzureCli.ps1
29 lines (22 loc) · 1.08 KB
/
Install-AzureCli.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
################################################################################
## File: Install-AzureCli.ps1
## Desc: Install and warm-up Azure CLI
################################################################################
Write-Host 'Install the latest Azure CLI release'
$azureCliConfigPath = 'C:\azureCli'
# Store azure-cli cache outside of the provisioning user's profile
[Environment]::SetEnvironmentVariable('AZURE_CONFIG_DIR', $azureCliConfigPath, "Machine")
$azureCliExtensionPath = Join-Path $env:CommonProgramFiles 'AzureCliExtensionDirectory'
New-Item -ItemType 'Directory' -Path $azureCliExtensionPath | Out-Null
[Environment]::SetEnvironmentVariable('AZURE_EXTENSION_DIR', $azureCliExtensionPath, "Machine")
Install-Binary -Type MSI `
-Url 'https://aka.ms/installazurecliwindowsx64' `
-ExpectedSignature 'C2048FB509F1C37A8C3E9EC6648118458AA01780'
Update-Environment
# Warm-up Azure CLI
Write-Host "Warmup 'az'"
az --help | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "Command 'az --help' failed"
}
Invoke-PesterTests -TestFile 'CLI.Tools' -TestName 'Azure CLI'