-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
- Package Name: azure.identity
- Package Version: 1.6.0
- Operating System: Linux debian (the python:3.7-slim-buster image)
- Python Version: 3.7
Describe the bug
When using DefaultAzureCredential() in a jupyter notebook in a linux docker container, it dumps either pyobject or libsecret errors from the SharedTokenCacheCredential, which is confusing to users
To Reproduce
Steps to reproduce the behavior:
- docker run -it python:3.7-slim-buster /bin/bash
- run:
> apt install libgirepository1.0-dev libcairo2-dev python3-dev gir1.2-secret-1 > pip install pygobject > pip install azure-identity > python > from azure.identity import DefaultAzureCredential > DefaultAzureCredential().get_token("https://quantum.microsoft.com/.default")
- See libsecret errors when trying SharedTokenCacheCredential:
libsecret did not perform properly.
* If you encountered error "Remote error from secret service:
org.freedesktop.DBus.Error.ServiceUnknown",
you may need to install gnome-keyring package.
* Headless mode (such as in an ssh session) is not supported.
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/msal_extensions/libsecret.py", line 126, in trial_run
agent.save(payload) # It would fail when running inside an SSH session
File "/usr/local/lib/python3.7/site-packages/msal_extensions/libsecret.py", line 103, in save
data, None)
gi.repository.GLib.GError: g-io-error-quark: Cannot autolaunch D-Bus without X11 $DISPLAY (0)
libsecret did not perform properly.
* If you encountered error "Remote error from secret service:
org.freedesktop.DBus.Error.ServiceUnknown",
you may need to install gnome-keyring package.
* Headless mode (such as in an ssh session) is not supported.
Expected behavior
DefaultAzureCredential should hide or suppress libsecret errors for SharedTokenCacheCredential.
It also looks like DotNet Azure.Identity excludes SharedTokenCacheCredential by default. For consistency across SDKs, it would also be great if azure-sdk-for-python similarly excluded SharedTokenCacheCredential from DefaultAzureCredential, since it really only works on Windows, and seems to cause issues on other systems.
For consistency, can the azure-identity package also set exclude_shared_token_cache_credential=True by default?
Merged PR for azure-sdk-for-net to remove SharedTokenCacheCredential from default: Azure/azure-sdk-for-net#16615
Related Issue: Azure/azure-sdk-for-net#17052