az webapp deployment source config-zip throws useless warning
Describe the bug When deploying a WebApp from a zip file with az webapp deployment source config-zip (azure cli 2.0.39), I get this warnings:
az : WARNING: Generating deployment script. At C:\my\full\path\MyScript.ps1:129 char:13
-
az functionapp deployment source config-zip --src $Packag ... -
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- CategoryInfo : NotSpecified: (WARNING: Generating deployment script.:String) [], RemoteException
- FullyQualifiedErrorId : NativeCommandError
Different one: az : WARNING: Updating submodules.
The command works correctly, but the warning is written in red and is detected by VSTS tasks as an error, causing the task to fail. I'm not able to capture it in any way.
To Reproduce Use az webapp deployment source config-zip --src "path/to/WebContent.zip" -n "AppServiceName" -g "ResourceGroupName"
Expected behavior Deployment works correctly, so no warnings should be thrown. If any, they should be more descriptive and not be formatted as errors.
Environment summary CLI version 2.0.39 / Windows 10 / Powershell 5.1.17134.165
@diirib, are you running the CLI inside the PowerShell ISE? And it is known that ISE will treat every single warning (emitted to STDERR) as a scrip error
Yes, I am. That might be the problem. Any workarounds?
There is no workaround really. Please consider using a regular POSH? I am closing this as this is not something CLI can handle. Warnings have to get to stderr, but ISE treats every single message from stderr as an error, hence lots tools won't work inside like git command, cli, etc.
I found a work around when working in regular powershell that might also work in the ISE:
$old_ErrorActionPreference = $ErrorActionPreference
$ErrorActionPreference = 'SilentlyContinue'
#Execute your code that thows a warning
$ErrorActionPreference = $old_ErrorActionPreference