Tech Tip – Azure DevOps Pipelines Newline handling

Just a quick note: It would seem that somewhere between Friday, April 29, 2022 and Monday, May 2, 2022, Azure DevOps pipelines changed their handling of newlines in YAML literal blocks. The change caused our pipelines to stop executing with the following error:

While scanning a literal block scalar, found extra spaces in first line

What caused it? Multi-line, inline block definitions.

- powershell: |
    Write-Host "Azure Fails on this now"
  displayName: Bad Script
- powershell: |
    Write-Host "Azure works with this"
  displayName: Good Script