You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to be able to access an Azure SQL Server using the token based authentication method.
Using pyodbc this would look like this:
defget_conn():
connection_string='Driver={ODBC Driver 18 for SQL Server};Server=tcp:<SERVER_ADDRESS>,1433;Database=<DATABASE_NAME>;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30'credential=DefaultAzureCredential(exclude_interactive_browser_credential=False)
token_bytes=credential.get_token("https://database.windows.net/.default").token.encode("UTF-16-LE")
token_struct=struct.pack(f'<I{len(token_bytes)}s', len(token_bytes), token_bytes)
SQL_COPT_SS_ACCESS_TOKEN=1256# This connection option is defined by microsoft in msodbcsql.hconn=pyodbc.connect(connection_string, attrs_before={SQL_COPT_SS_ACCESS_TOKEN: token_struct})
returnconn
which used SQL_COPT_SS_ACCESS_TOKEN further described here in the attrs_before parameter - described as "attrs_before: Set low-level connection attributes before a connection is attempted."
I wonder if this is possible today using connectorX or if this could be added at a later date? (I'm no Rust dev but I see that tiberius does support AADToken auth - perhaps this can be leveraged to enable this feature in connectorX?)
Thanks!
The text was updated successfully, but these errors were encountered:
I would like to be able to access an Azure SQL Server using the token based authentication method.
Using pyodbc this would look like this:
which used SQL_COPT_SS_ACCESS_TOKEN further described here in the attrs_before parameter - described as "attrs_before: Set low-level connection attributes before a connection is attempted."
I wonder if this is possible today using connectorX or if this could be added at a later date? (I'm no Rust dev but I see that tiberius does support AADToken auth - perhaps this can be leveraged to enable this feature in connectorX?)
Thanks!
The text was updated successfully, but these errors were encountered: