Installed x64 CLI, get error no TLS CA cert bundle in Program Files (x86)
Describe the bug
I just installed azure-cli-2.53.1-x64.msi on a Windows 10 system with no Azure CLI install.
The path C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\certifi correctly contains cacert.pem.
Now I open a prompt and type az --version
I get this - note how the Program Files (x86) path is checked, not Program Files.
➜ az --version Could not find a suitable TLS CA certificate bundle, invalid path: C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\certifi\cacert.pem The command failed with an unexpected error. Here is the traceback: Could not find a suitable TLS CA certificate bundle, invalid path: C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\certifi\cacert.pem Traceback (most recent call last): File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 225, in invoke File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/init.py", line 121, in show_version File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/util.py", line 372, in get_az_version_string File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/util.py", line 316, in _update_latest_from_github File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/util.py", line 861, in check_connectivity File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\requests/sessions.py", line 624, in head File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\requests/sessions.py", line 589, in request File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\requests/sessions.py", line 703, in send File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\requests/adapters.py", line 458, in send File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\requests/adapters.py", line 261, in cert_verify OSError: Could not find a suitable TLS CA certificate bundle, invalid path: C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\certifi\cacert.pem To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
Related command
az --version
Errors
Could not find a suitable TLS CA certificate bundle, invalid path: C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\certifi\cacert.pem
Issue script & Debug output
N/A
Expected behavior
az --version shows me expected Azure CLI and extension versions.
Environment Summary
az --version will not run. See above.
Additional context
No response
Thank you for opening this issue, we will look into it.
Hi @plzm Find similar issue https://github.com/Azure/azure-cli/issues/10079.
| Issue title | OSError: Could not find a suitable TLS CA certificate bundle, invalid path: C:\WINDOWS\System32\cacert.pem |
| Create time | 2019-07-27 |
| Comment number | 9 |
Possible solution:
It seems that the requests module is not reading from the correct CA bundle path. The solution provided in issue #10079 is to check if the REQUESTS_CA_BUNDLE environment variable is set to C:\WINDOWS\System32\cacert.pem by running SET in the command prompt. If it is set, remove the environment variable and retry the az login command. In this case, the error message is slightly different, but the root cause is the same - the requests module is not finding the correct CA bundle. Therefore, the solution provided in issue #10079 should also work for this issue.
Please confirm if this resolves your issue.
Hi @plzm Find similar issue #10079.
Issue title OSError: Could not find a suitable TLS CA certificate bundle, invalid path: C:\WINDOWS\System32\cacert.pem Create time 2019-07-27 Comment number 9 Possible solution: It seems that the
requestsmodule is not reading from the correct CA bundle path. The solution provided in issue #10079 is to check if theREQUESTS_CA_BUNDLEenvironment variable is set toC:\WINDOWS\System32\cacert.pemby runningSETin the command prompt. If it is set, remove the environment variable and retry theaz logincommand. In this case, the error message is slightly different, but the root cause is the same - therequestsmodule is not finding the correct CA bundle. Therefore, the solution provided in issue #10079 should also work for this issue.Please confirm if this resolves your issue.
Per that issue, I deleted the REQUESTS_CA_BUNDLE environment variable, started a new shell, verified the env var was gone, then tried az --version again. Now it works as expected.
After that, again started new shell. Verified REQUESTS_CA_BUNDLE was not re-created.
I was then able to successfully az login. After doing so, again started a new shell. Verified REQUESTS_CA_BUNDLE was still not re-created.
I suppose I will close this, since deleting the env var fixed it. Curious though why if I only have the x64 CLI installed, the env var was created pointing to Program Files (x86) instead of Program Files.