locked
In Azure DevOps, Azure HostedAgent shows unexpacted errors as compare to local powershell console outputs RRS feed

  • Question

  • Hello Folks,

    I'm using Azure DevOps pipelines to execute powershell scripts for creating the azure resources.
    With this powershell scripts, I'm able to setup whole our testing environment using my localmachine(windows 10).

    But when we execute the same script from Azure Powershell task(4.0), it executes the script nicely but at the end it show some huge list of errors about conversion. for your reference, have attached the screenshot of Azure DevOps Powershell Task console output.

    I'm not sure why such outputs are getting generated and i'm not able to replicate on my local machine.
    For logging, i'm using a ps function as,

    function Log {
        [CmdletBinding()]
        param
        (
            [Parameter(Mandatory = $true)] [string]$category,
            [Parameter(Mandatory = $true)] [string]$message
        )
        BEGIN { }
        PROCESS {
            $time = (Get-Date).ToString('HH:mm:ss')
            Write-Host ("{0}" -f $category.PadRight(27,' ')) -ForegroundColor Cyan -NoNewline
            Write-Host ("[{0}] - " -f $time) -ForegroundColor DarkCyan -NoNewline
            Write-Host ("{0}" -f $message) -ForegroundColor White
        }
        END { }
    }

    AzureHosted Agents Powershell Output



    Friday, April 24, 2020 10:56 AM

Answers