Azure-pipelines-tasks: errorActionPreference not working

Created on 31 Oct 2019  路  3Comments  路  Source: microsoft/azure-pipelines-tasks

Required Information

Type: Bug

Enter Task Name: AzurePowerShell@4
https://github.com/microsoft/azure-pipelines-tasks/tree/master/Tasks/AzurePowerShellV4

Environment

  • Server - Azure Pipelines
  • Agent - Hosted

    • Azure Pipelines - Image: VS2017

Issue Description

errorActionPreference not working

I'm passing errorActionPreference: stop into my task but
write-host "error preference is: $errorActionPreference"
is reporting
error preference is: Continue
Version : 4.159.3

Full task definition...

- task: AzurePowerShell@4
  displayName: 'Run Script'
  inputs:
    azureSubscription: '$(azureSubscription)'
    ScriptPath: '$(Pipeline.Workspace)/$(artifactName)/myScript.ps1'
    ScriptArguments: '
                      -location $(location)
                      -resourceGroupName $(resourceGroupName)'
    errorActionPreference: stop
    azurePowerShellVersion: 'OtherVersion'
    preferredAzurePowerShellVersion: '2.6.0'

And then the very first line in my script I have
write-host "error preference is: $errorActionPreference"
that prints error preference is: Continue

Release bug

All 3 comments

@winstonhenke
This issue has been fixed in new AzurePowerShell version i.e. 5.162.0 . It will take at least 3-4 weeks to get deployed.

Thanks!

The issue should have been fixed by now. It might take some time to mitigate though. Please comment if you're still facing it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jared-hexagon picture jared-hexagon  路  3Comments

timfish picture timfish  路  3Comments

HenrikStanley picture HenrikStanley  路  3Comments

yaananth picture yaananth  路  3Comments

montebhoover picture montebhoover  路  3Comments