From 3fbfb590d5a67fb09b48b801b68e36c391536822 Mon Sep 17 00:00:00 2001 From: "Vincent A (vinca)" Date: Mon, 14 Jan 2019 13:16:35 +0530 Subject: [PATCH] Set Error Action to Stop (#9327) --- Tasks/AzurePowerShellV2/task.json | 2 +- Tasks/AzurePowerShellV2/task.loc.json | 2 +- Tasks/AzurePowerShellV3/task.json | 2 +- Tasks/AzurePowerShellV3/task.loc.json | 2 +- Tasks/Common/VstsAzureHelpers_/Utility.ps1 | 16 ++++++++-------- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Tasks/AzurePowerShellV2/task.json b/Tasks/AzurePowerShellV2/task.json index c51fc3fb45e0..c67bd702b0b1 100644 --- a/Tasks/AzurePowerShellV2/task.json +++ b/Tasks/AzurePowerShellV2/task.json @@ -17,7 +17,7 @@ "version": { "Major": 2, "Minor": 1, - "Patch": 7 + "Patch": 8 }, "demands": [ "azureps" diff --git a/Tasks/AzurePowerShellV2/task.loc.json b/Tasks/AzurePowerShellV2/task.loc.json index 55bcf6e0c7d2..0c9f92a41ad0 100644 --- a/Tasks/AzurePowerShellV2/task.loc.json +++ b/Tasks/AzurePowerShellV2/task.loc.json @@ -17,7 +17,7 @@ "version": { "Major": 2, "Minor": 1, - "Patch": 7 + "Patch": 8 }, "demands": [ "azureps" diff --git a/Tasks/AzurePowerShellV3/task.json b/Tasks/AzurePowerShellV3/task.json index 95efbaa0dafc..fcad7d17c0a2 100644 --- a/Tasks/AzurePowerShellV3/task.json +++ b/Tasks/AzurePowerShellV3/task.json @@ -17,7 +17,7 @@ "version": { "Major": 3, "Minor": 1, - "Patch": 18 + "Patch": 19 }, "releaseNotes": "Added support for Fail on standard error and ErrorActionPreference", "demands": [ diff --git a/Tasks/AzurePowerShellV3/task.loc.json b/Tasks/AzurePowerShellV3/task.loc.json index 9ee6b268e4a7..e5293b5921a6 100644 --- a/Tasks/AzurePowerShellV3/task.loc.json +++ b/Tasks/AzurePowerShellV3/task.loc.json @@ -17,7 +17,7 @@ "version": { "Major": 3, "Minor": 1, - "Patch": 18 + "Patch": 19 }, "releaseNotes": "ms-resource:loc.releaseNotes", "demands": [ diff --git a/Tasks/Common/VstsAzureHelpers_/Utility.ps1 b/Tasks/Common/VstsAzureHelpers_/Utility.ps1 index 107fcdac0fba..2ec3fd86ee12 100644 --- a/Tasks/Common/VstsAzureHelpers_/Utility.ps1 +++ b/Tasks/Common/VstsAzureHelpers_/Utility.ps1 @@ -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 {