Open Q&A
If there's no good subforum for your question - ask it here!
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Python Extension SDK fails connecting to MS SQL Server by using Windows Authentication - Linux AGs

chris_cho
Helper

Hello,
I created a generic custom extension using Dynatrace Python Extensions SDK to extract some data from MS SQL Servers - database tables.
Below are some specs:

  • ActiveGates are RHEL VMs with Python 3.6
  • for development I am using VS Code with Python 3.10.
  • connecting to MS SQL Server, I am using pypyodbc with driver ODBC Driver 17 for SQL Server; due to some compatibility issues I cannot use pyodbc. The functionality should be same as pypyodbc
  • additionally on the Linux AGs, to work with pypyodbc, I installed unixODBC, unixODBC-devel, msodbcsql17.
  • connecting to the target MS SQL servers we use Windows authentication, by providing AD usernames and passwords
  • the Python code uses the connection string as
conn_str = (f"DRIVER={{ODBC Driver 17 for SQL Server}};"
	f"SERVER={self.sql_server};"
	f"DATABASE={self.sql_database};"
	f"UID={self.ad_username};"
	f"PWD={self.ad_password};"
	"Encrypt=yes;"
	"TrustServerCertificate=yes;"
	"Connection Timeout=5;"
)​

where UID is provided from the extension UI as "domain\username".

It looks like the MS SQL servers consider the username and password as SQL Authentication, and not as Windows Authentication.
I have tried other properties defining the connection string conn_str, but still the code fails due to the exception.

Error fetching data from SQL Server for feed 'poc_mssql_extract': ('28000', "[28000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Login failed for user '<domain>\\<username>'.")

where <domain>\<username> are the AD domain and username, provided by the extension UI, along with the password.
On the other hand, I tested the domain, username and password, by creating a SQL Extension from, Custom Extensions Creator, using NTLM Authentication. I executed successfully this SQL extension that connected to MS SQL Server and retrieved the expected dataset from.

Please let me know if you have any suggestions or workaround to my custom extension, created with Dynatrace Python Extensions SDK, connecting to MS SQL Server and getting data from.

Regards,

Chris

 

The UI configuration of my custom extension (SDK)The UI configuration of Dynatrace SQL extension
chris_cho_0-1767148915757.png

 

chris_cho_1-1767146430604.png

 

0 REPLIES 0

Featured Posts