-
Notifications
You must be signed in to change notification settings - Fork 50
Caching issues with EntraID credentials #388
Copy link
Copy link
Closed
Labels
area: connectivity-authConnection lifecycle, Entra/SP/NTLM auth, tokens, TLS, conn-string parsing, Fabric endpoints.Connection lifecycle, Entra/SP/NTLM auth, tokens, TLS, conn-string parsing, Fabric endpoints.enhancementNew feature or requestNew feature or requesttriage neededFor new issues, not triaged yet.For new issues, not triaged yet.
Metadata
Metadata
Assignees
Labels
area: connectivity-authConnection lifecycle, Entra/SP/NTLM auth, tokens, TLS, conn-string parsing, Fabric endpoints.Connection lifecycle, Entra/SP/NTLM auth, tokens, TLS, conn-string parsing, Fabric endpoints.enhancementNew feature or requestNew feature or requesttriage neededFor new issues, not triaged yet.For new issues, not triaged yet.
Type
Fields
Give feedbackNo fields configured for Feature.
Is your feature request related to a problem? Please describe.
Yes, I am experiencing ~1s latency per connection when using
Authentication=ActiveDirectoryDefaultwithAzureCliCredential(in a FastAPI app).The
mssql-pythondriver instantiates a newDefaultAzureCredentialobject for every newconnect()call. Since the Azure CLI credential in theazure-identitylibrary does not provide token caching, this triggers a slow az subprocess call for every single database request, creating a massive performance bottleneck.Describe the solution you'd like
The driver should implement its own token caching mechanism.
Describe alternatives you've considered
I've considered passing my own token using
attrs_before, but this would require developing my own token cache. I think it makes more sense for the DB driver to handle the caching.Additional context
The redis-py-entraid library avoids this issue by implementing its own token caching layer.