Current agent version: '2.165.0'
Current image version: '20200308.0'
Windows
dev.azure.com
The hosted agents have recently updated to PowerShell 7. Since this change errors are not being written to the console. This seems to be related to the new ConciseView error setting. After changing it to NormalView errors are displayed again
azure-pipelines.yaml
jobs:
- job: job1
pool:
vmImage: windows-latest
steps:
- pwsh: |
throw "test"
failOnStderr: true
errorActionPreference: stop
condition: always()
displayName: ConciseView
- pwsh: |
$ErrorView = "NormalView"
throw "test"
failOnStderr: true
errorActionPreference: stop
condition: always()
displayName: NormalView
- powershell: |
throw "test"
failOnStderr: true
errorActionPreference: stop
condition: always()
displayName: PowerShell 5



@hbuckle - This behavior is outside the control of the Pipelines Agent. The agent just invokes whatever Powershell is installed on the machine it is running on. You can open an issue against the team that manages the hosted images (https://github.com/actions/virtual-environments) to see if they are able to change the default value of $ErrorView in these images.
Closing since this is not an issue on the pipelines agent itself.
@jtpetty - but why does the error not show in ConciseView? It's still an error. I'd rather have ConciseView than Normal view as its easier to read
I agree that the error message in ConciseView shouldn't be suppressed...this looks like a bug to me. I'm running a powershell script in a ps1 file, and setting $ErrorView = "NormalView" from within the script doesn't seem to work. Is there any workaround in this case?
@fabio-muramatsu you can change it from the yml and the same for other vars see my comment at
https://github.com/microsoft/azure-pipelines-tasks/issues/12550#issuecomment-610247125
Thank you for the suggestion, @apobekiaris. Just to make sure I understand what you did, you switched the task to inline script, set the $ErrorView variable, and then called the script from the ps1 file. Is that correct?
@fabio-muramatsu yes right the same is needed for other global vars e.g. $VerbosePreference this wasn't the case b4
@jtpetty This just breaks using pwsh in pipelines. We've slowly started migrating back to powershell 5 in our pipelines simply so that we can get error reporting correctly. This needs to be resolved.
This is more relevant to the powershell JS task which is what is called rather than the agent, I'll try creating a new issue over there.
Most helpful comment
@jtpetty - but why does the error not show in ConciseView? It's still an error. I'd rather have ConciseView than Normal view as its easier to read