Skip to content

Commit

Permalink
Merge pull request #2662 from jonaswre/fix_install-azdevops
Browse files Browse the repository at this point in the history
Changed upgrade process.
  • Loading branch information
freddydk authored Sep 25, 2022
2 parents 40f165a + 73b5973 commit d3f4ade
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions PackageHandling/Install-AzDevops.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ function Install-AzDevops {
Param(
)

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

Try {
az upgrade
$az_upgrade = Write-Output n | az upgrade 2>&1
} catch {
$az_upgrade = ""
}

if (@($az_upgrade | Select-String "Latest version available").Count -ne 0) {
Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; rm .\AzureCLI.msi
}
$extensions = az extension list -o json | ConvertFrom-Json
Expand All @@ -29,13 +33,13 @@ try {
if ($devopsFound -eq $False){
az extension add -n azure-devops
}
}
catch {
TrackException -telemetryScope $telemetryScope -errorRecord $_
throw
}
finally {
TrackTrace -telemetryScope $telemetryScope
}
catch {
TrackException -telemetryScope $telemetryScope -errorRecord $_
throw
}
finally {
TrackTrace -telemetryScope $telemetryScope
}
}
Export-ModuleMember -Function Install-AzDevops

0 comments on commit d3f4ade

Please sign in to comment.