I am connecting to an Azure SQL database using pyodcb
. We have multi-factor authentication enabled, so I am using ActiveDirectoryInteractive
authentication. We also use single sign-on for Windows.
My code is as follows:
import pyodbc
driver = '{ODBC Driver 17 for SQL Server}'
server = 'xxxxxxxxxxxxx.database.windows.net'
database = 'xxxxxxxxxxxxx'
authentication = 'ActiveDirectoryInteractive'
username = 'xxxxxxxxxxxxx'
conn = pyodbc.connect(
'DRIVER=' + driver + ';' +
'SERVER=' + server + ';' +
'DATABASE=' + database + ';' +
'UID=' + username + ';' +
'AUTHENTICATION=' + authentication + ';')
cursor = conn.cursor()
When I run the script I get pop-ups to submit my password and MFA details. But the connection works whether I fill in these details or just close the prompts - suggesting that single sign-on is working successfully. So why am I getting the password and MFA pop-ups - and how can I suppress them?
from ODBC connection to Azure using ActiveDirectoryInteractive
No comments:
Post a Comment