azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

az webapp deployment source config-zip throws useless warning

Open diirib opened this issue 8 years ago • 4 comments

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 avatar Jul 17 '18 15:07 diirib

@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

yugangw-msft avatar Jul 17 '18 19:07 yugangw-msft

Yes, I am. That might be the problem. Any workarounds?

diirib avatar Jul 18 '18 11:07 diirib

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.

yugangw-msft avatar Jul 18 '18 15:07 yugangw-msft

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

Stewartarmbrecht avatar Sep 29 '18 11:09 Stewartarmbrecht