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 @@ -247,6 +247,7 @@ def get_new_connection(self, conn_params):
247247 options = conn_params .get ('OPTIONS' , {})
248248 driver = options .get ('driver' , 'ODBC Driver 13 for SQL Server' )
249249 dsn = options .get ('dsn' , None )
250+ auth = options .get ('Authentication' , None )
250251
251252 # Microsoft driver names assumed here are:
252253 # * SQL Server Native Client 10.0/11.0
@@ -291,6 +292,16 @@ def get_new_connection(self, conn_params):
291292
292293 if ms_drivers .match (driver ) and os .name == 'nt' :
293294 cstr_parts ['MARS_Connection' ] = 'yes'
295+
296+ # User may want to use Azure AD Interactive connection option
297+ # It the user specified active directory interactive auth,
298+ # we neet to make sure pwd is not set and the connection is not
299+ # trusted as otherwise the driver will refuse to connect
300+ if auth :
301+ cstr_parts ['Authentication' ] = auth
302+ if auth == 'ActiveDirectoryInteractive' :
303+ cstr_parts .pop ('PWD' )
304+ cstr_parts ['Trusted_Connection' ] = 'no'
294305
295306 connstr = encode_connection_string (cstr_parts )
296307
You can’t perform that action at this time.
0 commit comments