File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -245,6 +245,7 @@ def get_new_connection(self, conn_params):
245
245
options = conn_params .get ('OPTIONS' , {})
246
246
driver = options .get ('driver' , 'ODBC Driver 13 for SQL Server' )
247
247
dsn = options .get ('dsn' , None )
248
+ auth = options .get ('Authentication' , None )
248
249
249
250
# Microsoft driver names assumed here are:
250
251
# * SQL Server Native Client 10.0/11.0
@@ -289,6 +290,16 @@ def get_new_connection(self, conn_params):
289
290
290
291
if ms_drivers .match (driver ) and os .name == 'nt' :
291
292
cstr_parts ['MARS_Connection' ] = 'yes'
293
+
294
+ # User may want to use Azure AD Interactive connection option
295
+ # It the user specified active directory interactive auth,
296
+ # we neet to make sure pwd is not set and the connection is not
297
+ # trusted as otherwise the driver will refuse to connect
298
+ if auth :
299
+ cstr_parts ['Authentication' ] = auth
300
+ if auth == 'ActiveDirectoryInteractive' :
301
+ cstr_parts .pop ('PWD' )
302
+ cstr_parts ['Trusted_Connection' ] = 'no'
292
303
293
304
connstr = encode_connection_string (cstr_parts )
294
305
You can’t perform that action at this time.
0 commit comments