I have tried to connect sql server using pyodbc library,
driver= '{ODBC Driver 17 for SQL Server}'
cnxn = pyodbc.connect('DRIVER='+driver+';SERVER='+host+';PORT=1443;DATABASE='+database+';UID='+user+';PWD='+ password+';Authentication=ActiveDirectoryPassword')
In the above code, I have choosen ActiveDirectoryPassword(AAD) as my authentication type as I have AAD access only.But getting the following error message.
InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')
When I changed the driver to ODBC Driver 13, getting different error message.
driver= '{ODBC Driver 13 for SQL Server}'
cnxn = pyodbc.connect('DRIVER='+driver+';SERVER='+host+';PORT=1443;DATABASE='+database+';UID='+user+';PWD='+ password+';Authentication=ActiveDirectoryPassword')
This time I was getting the following error message.
OperationalError: ('08001', '[08001] [Microsoft][ODBC Driver 13 for SQL Server]SQL Server Network Interfaces: The Microsoft Online Services Sign-In Assistant could not be found. Install it from http://go.microsoft.com/fwlink/?LinkId=234947. If it is already present, repair the installation. [2]. (2) (SQLDriverConnect); [08001] [Microsoft][ODBC Driver 13 for SQL Server]Client unable to establish connection (2); [08001] [Microsoft][ODBC Driver 13 for SQL Server]Invalid connection string attribute (0)')
Is it possible to connect azure sql server using pyodbc with AAD authentication? if possible what is the proper way to authenticate sql server with AAD?