Skip to content

Commit d3f4ade

Browse files
author
Freddy Kristiansen
authored
Merge pull request #2662 from jonaswre/fix_install-azdevops
Changed upgrade process.
2 parents 40f165a + 73b5973 commit d3f4ade

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

PackageHandling/Install-AzDevops.ps1

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@ function Install-AzDevops {
88
Param(
99
)
1010

11-
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
12-
try {
11+
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
12+
try {
1313

1414
Try {
15-
az upgrade
15+
$az_upgrade = Write-Output n | az upgrade 2>&1
1616
} catch {
17+
$az_upgrade = ""
18+
}
19+
20+
if (@($az_upgrade | Select-String "Latest version available").Count -ne 0) {
1721
Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; rm .\AzureCLI.msi
1822
}
1923
$extensions = az extension list -o json | ConvertFrom-Json
@@ -29,13 +33,13 @@ try {
2933
if ($devopsFound -eq $False){
3034
az extension add -n azure-devops
3135
}
32-
}
33-
catch {
34-
TrackException -telemetryScope $telemetryScope -errorRecord $_
35-
throw
36-
}
37-
finally {
38-
TrackTrace -telemetryScope $telemetryScope
36+
}
37+
catch {
38+
TrackException -telemetryScope $telemetryScope -errorRecord $_
39+
throw
40+
}
41+
finally {
42+
TrackTrace -telemetryScope $telemetryScope
3943
}
4044
}
4145
Export-ModuleMember -Function Install-AzDevops

0 commit comments

Comments
 (0)