Skip to content

Commit

Permalink
Set Error Action to Stop (#9327)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent1173 authored Jan 14, 2019
1 parent 9fe5c14 commit 3fbfb59
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Tasks/AzurePowerShellV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"version": {
"Major": 2,
"Minor": 1,
"Patch": 7
"Patch": 8
},
"demands": [
"azureps"
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzurePowerShellV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"version": {
"Major": 2,
"Minor": 1,
"Patch": 7
"Patch": 8
},
"demands": [
"azureps"
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzurePowerShellV3/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"version": {
"Major": 3,
"Minor": 1,
"Patch": 18
"Patch": 19
},
"releaseNotes": "Added support for Fail on standard error and ErrorActionPreference",
"demands": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzurePowerShellV3/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"version": {
"Major": 3,
"Minor": 1,
"Patch": 18
"Patch": 19
},
"releaseNotes": "ms-resource:loc.releaseNotes",
"demands": [
Expand Down
16 changes: 8 additions & 8 deletions Tasks/Common/VstsAzureHelpers_/Utility.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -496,21 +496,21 @@ function Disconnect-AzureAndClearContext {
Write-Verbose "Trying to disconnect from Azure and clear context at process scope"

if (Get-Command -Name "Disconnect-AzureRmAccount" -ErrorAction "SilentlyContinue" -and CmdletHasMember -cmdlet Disconnect-AzureRmAccount -memberName Scope) {
Write-Host "##[command]Disconnect-AzureRmAccount -Scope Process"
$null = Disconnect-AzureRmAccount -Scope Process
Write-Host "##[command]Disconnect-AzureRmAccount -Scope Process -ErrorAction Stop"
$null = Disconnect-AzureRmAccount -Scope Process -ErrorAction Stop
}
elseif (Get-Command -Name "Remove-AzureRmAccount" -ErrorAction "SilentlyContinue" -and CmdletHasMember -cmdlet Remove-AzureRmAccount -memberName Scope) {
Write-Host "##[command]Remove-AzureRmAccount -Scope Process"
$null = Remove-AzureRmAccount -Scope Process
Write-Host "##[command]Remove-AzureRmAccount -Scope Process -ErrorAction Stop"
$null = Remove-AzureRmAccount -Scope Process -ErrorAction Stop
}
elseif (Get-Command -Name "Logout-AzureRmAccount" -ErrorAction "SilentlyContinue" -and CmdletHasMember -cmdlet Logout-AzureRmAccount -memberName Scope) {
Write-Host "##[command]Logout-AzureRmAccount -Scope Process"
$null = Logout-AzureRmAccount -Scope Process
Write-Host "##[command]Logout-AzureRmAccount -Scope Process -ErrorAction Stop"
$null = Logout-AzureRmAccount -Scope Process -ErrorAction Stop
}

if (Get-Command -Name "Clear-AzureRmContext" -ErrorAction "SilentlyContinue") {
Write-Host "##[command]Clear-AzureRmContext -Scope Process"
$null = Clear-AzureRmContext -Scope Process
Write-Host "##[command]Clear-AzureRmContext -Scope Process -ErrorAction Stop"
$null = Clear-AzureRmContext -Scope Process -ErrorAction Stop
}
}
} catch {
Expand Down

0 comments on commit 3fbfb59

Please sign in to comment.