mkleehammer / pyodbc

Python ODBC bridge
https://github.com/mkleehammer/pyodbc/wiki
MIT No Attribution
2.88k stars 561 forks source link

How to surface azure active directory service principal related errors #1365

Closed prdpsvs closed 1 day ago

prdpsvs commented 1 week ago

Environment

Issue

I am using Azure Service Principal Authentication with pyodbc. what is the best way to surface issue when user provides incorrect client id or secret. Right now, any error during connection is throwing ('HYT00', '[HYT00] [Microsoft][ODBC Driver 18 for SQL Server]Login timeout expired (0) (SQLDriverConnect)')

I tried to capture errors from azure identity SDK using from azure.core.exceptions import ClientAuthenticationError, HttpResponseError but no luck. Any thoughts?

v-chojas commented 4 days ago

The driver returns several diag recs; do you see those in the ODBC trace?

prdpsvs commented 4 days ago

I would like to capture these at the connection failure time programmatically and appropriately surface user-friendly messages. Any specific options to figure out?

v-chojas commented 3 days ago

I am asking if you see all the diag recs in the ODBC trace.