Azure / Azure/azure-cli

Cannot hide urllib3 warning

Open
#32,385 3 comments 0 reactions 2 assignees Claimed by @bebound View on GitHub
Azure CLI Team customer-reported question
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

Hi everyone,

We are using azure cli with the --only-show-errors flag, but there is a warning from urllib3 which it is not hiding from the output when a local proxy is in use.

I have tried to turn the warning out, passing python the -w flag and via environment variables.
https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings
https://stackoverflow.com/questions/27981545/suppress-insecurerequestwarning-unverified-https-request-is-being-made-in-pytho

This behaviour brakes some scripts, becaues the output of az cli is containing on top of the json output the warning text.

How could we address this issue the best way?
Could that be corrected and configured viathe tool flag?

### Related command

All the commands are affected

### Errors

-

### Issue script & Debug output

D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings

### Expected behavior

Warning text is not showing up when using --only-show-errors

### Environment Summary

{
"azure-cli": "2.79.0",
"azure-cli-core": "2.79.0",
"azure-cli-telemetry": "1.1.0",
"extensions": {
"aks-preview": "19.0.0b5",
"amg": "2.8.1",
"azure-devops": "1.0.2",
"serviceconnector-passwordless": "3.3.6"
}
}

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.