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'm having trouble using pyodbc to connect to a SQL database using Microsoft Entra MFA through my company. When I connect using SSMS, I select Database Engine as server type, select the appropriate server name, use Microsoft Entra MFA for Authentication type, first.last@company for username, and for Encryption selet Mandatory in the drop down. When I think click connect, it opens a browser window with the screen below asking me to pick an account (the one shown for my company is actuall [email protected]), and all I have to do is click on that account and the browser refreshes to show Authentication complete and I'm connected.
I've treid various ways of connecting using pyodbc - using the below code I can get a windown to show up that is similar to the single sign-on window above, but rather than allowing me to click on account it asks me to input my password and then when I do, it asks if I want to receive an SMS or Call to authenticate that I need to answer, defeating the purpose of automating this connection.
Here's the code used to get to that sign on screen in the second image:
server = 'sqlservername.database.windows.net' database = 'database_name' driver = '{ODBC Driver 18 for SQL Server}' conn = pyodbc.connect('DRIVER='+driver+';SERVER='+server+ ';PORT=1433;DATABASE='+database+ ';Authentication=ActiveDirectoryInteractive;[email protected]')
I've also tried using the above code and setting UID=[email protected], but that doesn't work either. After reading through some articles I've tried multiple other authentication methods:
Authentication=ActiveDirectoryIntegrated - this results in an error saying failed to authenticate user (with both email formats)
Authentication=ActiveDirectoryPassword and pass along my pwrd - this gives an unknown error for both email formats
Authentication=ActiveDirectoryMsi - this give a requesting access token error.
Any assistance would be greatly apprecaited, if I could just get the python script to open the same authentication window in my browser I could use Selenium or something simliar to click on the correct account (or if this could be automated another way even better). Thanks in advance for any assistance.
The text was updated successfully, but these errors were encountered:
I'm having trouble using pyodbc to connect to a SQL database using Microsoft Entra MFA through my company. When I connect using SSMS, I select Database Engine as server type, select the appropriate server name, use Microsoft Entra MFA for Authentication type, first.last@company for username, and for Encryption selet Mandatory in the drop down. When I think click connect, it opens a browser window with the screen below asking me to pick an account (the one shown for my company is actuall [email protected]), and all I have to do is click on that account and the browser refreshes to show Authentication complete and I'm connected.
I've treid various ways of connecting using pyodbc - using the below code I can get a windown to show up that is similar to the single sign-on window above, but rather than allowing me to click on account it asks me to input my password and then when I do, it asks if I want to receive an SMS or Call to authenticate that I need to answer, defeating the purpose of automating this connection.
Here's the code used to get to that sign on screen in the second image:
server = 'sqlservername.database.windows.net' database = 'database_name' driver = '{ODBC Driver 18 for SQL Server}' conn = pyodbc.connect('DRIVER='+driver+';SERVER='+server+ ';PORT=1433;DATABASE='+database+ ';Authentication=ActiveDirectoryInteractive;[email protected]')
I've also tried using the above code and setting UID=[email protected], but that doesn't work either. After reading through some articles I've tried multiple other authentication methods:
Authentication=ActiveDirectoryIntegrated - this results in an error saying failed to authenticate user (with both email formats)
Authentication=ActiveDirectoryPassword and pass along my pwrd - this gives an unknown error for both email formats
Authentication=ActiveDirectoryMsi - this give a requesting access token error.
Any assistance would be greatly apprecaited, if I could just get the python script to open the same authentication window in my browser I could use Selenium or something simliar to click on the correct account (or if this could be automated another way even better). Thanks in advance for any assistance.
The text was updated successfully, but these errors were encountered: