WARNING: Unable to encode the output with cp1252 encoding
06:32 19 Dec 2025

I am trying to run a powershell script on Microsoft hosted agent "windows-latest", It uses below az cli command:

 $projects = az devops project list --organization "https://dev.azure.com/$org_name/" --output json | ConvertFrom-Json

When I am running this on pipeline I am getting below error:

##[error]WARNING: Unable to encode the output with cp1252 encoding. Unsupported characters are discarded.

What have i tried:

  1. [Console]::OutputEncoding = [Text.UTF8Encoding]::UTF8

  2. az devops project list --organization "https://dev.azure.com/k-c" 3>$null
    
  3. $env:PYTHONIOENCODING = 'utf-8'

  4. Tried running the same script on other windows images, self hosted agents but same issue.

This is breaking my entire pipeline and I have been stuck with it quite some time. Please help.

powershell azure-devops azure-pipelines cp1252