Azure / azure-cli

Azure Command-Line Interface
MIT License
3.97k stars 2.95k forks source link

--only-show-errors not honoured for az network bastion ssh #28685

Open dazinator opened 5 months ago

dazinator commented 5 months ago

Describe the bug

using the az network bastion ssh with

This suppresses most output to STDERR except this one

Err> Generated SSH certificate C:\Users\FOO~1\AppData\Local\Temp\AWDAWD\id_rsa.pub-aadcert.pub is valid until 2024-04-03 15:28:39 in local time.

This log output on STDERR should also be supressed as it isn't technically an error.

Related command

az network bastion ssh --auth-type AAD --only-show-errors

Errors

Generated SSH certificate C:\Users\FOO~1\AppData\Local\Temp\AWDAWD\id_rsa.pub-aadcert.pub is valid until 2024-04-03 15:28:39 in local time.

This isn't an error but it was written to STDERR even though --only-show-errors switch was specified.

Issue script & Debug output

Generated SSH certificate C:\Users\FOO~1\AppData\Local\Temp\AWDAWD\id_rsa.pub-aadcert.pub is valid until 2024-04-03 15:28:39 in local time.

Expected behavior

As --only-show-errors is used, it should surpress things from being written to STDERR that aren't actually errors. It works for other logs, but this particular log statement about the cert is not supressed.

Environment Summary

azure-cli 2.53.0 *

core 2.53.0 * telemetry 1.1.0

Extensions: azure-devops 0.26.0 bastion 0.2.5 ssh 2.0.2

Dependencies: msal 1.24.0b2 azure-mgmt-resource 23.1.0b2

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe' Extensions directory 'C:\Users\FOO.azure\cliextensions'

Additional context

I am automating executing an ssh command using az network bastion ssh. In this situation in order to work out if the SSH script has problems I don't want false positive errors being written to STDERR.

azure-client-tools-bot-prd[bot] commented 5 months ago

Hi @dazinator,

2.53.0 is not the latest Azure CLI(2.59.0).

If you haven't already attempted to do so, please upgrade to the latest Azure CLI version by following https://learn.microsoft.com/en-us/cli/azure/update-azure-cli.

yonzhan commented 5 months ago

Thank you for opening this issue, we will look into it.