Exception when trying to connect with DataLakeServiceClient using invalid ClientSecretCredential credentials
- Package Name: azure-storage-file-datalake
- Package Version: 12.14.0
- Operating System: macOS Ventura 13.6.1
- Python Version: 3.7.12
Describe the bug
Try to connect with DataLakeServiceClient using invalid ClientSecretCredential credentials. It throws an exception in here - AttributeError: 'str' object has no attribute 'get'
To Reproduce Try this sample code below.
from azure.storage.filedatalake.aio import DataLakeServiceClient
from azure.identity.aio import ClientSecretCredential
import asyncio
client_id = <client_id>
tenant_id = <tenant_id>
client_secret = <invalid_client_secret>
account_name = <account_name>
creds = ClientSecretCredential(tenant_id, client_id, client_secret)
async def func():
async with DataLakeServiceClient("https://{}.dfs.core.windows.net".format(account_name), credential=creds) as dls_client:
await dls_client.get_file_system_client('dummy-test').exists()
asyncio.run(func())
Expected behavior It should've thrown an exception ClientAuthenticationError
Additional context
If we import from from azure.identity import ClientSecretCredential, it throws proper exception ClientAuthenticationError. The attribute error exception occurs when we import from from azure.identity.aio import ClientSecretCredential
Thanks for the feedback, we’ll investigate asap.
Hi @nee2shaji, thanks for bringing the issue to our attention. I was able to reproduce this and tracked down the issue to be caused by a small difference in how azure-identity` handles authentication errors between their sync and async classes. I just put up a PR to fix this issue. This change will come in our next release planned for early next year. Thanks again.
Thank you!