I’m really struggling with this one & I’m sure there’s some simple fix I’m missing.
I have an Azure Powershell step which runs a script that includes the az cli command az storage blob upload-batch to upload a bunch of files to a storage account. For reasons I can’t understand, this command writes its progress as errors. You can add the --no-progress command but this just stops it writing pretty progress bars, which are useless from a log file. In a more recent az cli (2.3.1) there is the --only-show-errors switch.
The trouble with trying to reproduce this, is when run interactively there is no indication it’s logging errors. It’s only in Octopus that they get logged as errors.
I’ve tried redirecting the stream using various combinations of 2>&1. Despite what the docs say, this is the only one that sort of worked, in that it failed after the command finished because it didn’t understand the log messages generated by Octopus.
Not working at all:
ParserError: At D:\Octopus\Work\20200722123152-76992-877\Script.ps1:18 char:112 July 22nd 2020 13:32:05 Error + ... ss" -d $targetUrl --destination-path "$($path)css" --no-progress 2>&4 July 22nd 2020 13:32:05 Error + ~ July 22nd 2020 13:32:05 Error Missing file specification after redirection operator. July 22nd 2020 13:32:05 Error At D:\Octopus\Work\20200722123152-76992-877\Script.ps1:18 char:112 July 22nd 2020 13:32:05 Error + ... ss" -d $targetUrl --destination-path "$($path)css" --no-progress 2>&4 July 22nd 2020 13:32:05 Error + ~ July 22nd 2020 13:32:05 Error The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double quotation marks ("&") to pass it as part of a string. July 22nd 2020 13:32:05 Error
Not understanding errors:
NotSpecified: WARNING: uploading D:\Octopus\Work\20200722122547-76990-873\assets\css\animate.css 13:26:06 Error | At D:\Octopus\Work\20200722122547-76990-873\Script.ps1:18 char:1 13:26:06 Error | + az storage blob upload-batch -s "$basepath\css" -d $targetUrl --desti ...