<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Python Extension SDK fails connecting to MS SQL Server by using Windows Authentication - Linux AGs in Extensions</title>
    <link>https://community.dynatrace.com/t5/Extensions/Python-Extension-SDK-fails-connecting-to-MS-SQL-Server-by-using/m-p/292331#M6981</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;I created a generic custom extension using Dynatrace Python Extensions SDK to extract some data from MS SQL Servers - database tables.&lt;BR /&gt;Below are some specs:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;ActiveGates are RHEL VMs with &lt;STRONG&gt;Python 3.6&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;for development I am using VS Code with &lt;STRONG&gt;Python 3.10&lt;/STRONG&gt;.&lt;/LI&gt;
&lt;LI&gt;connecting to MS SQL Server, I am using &lt;STRONG&gt;pypyodbc&lt;/STRONG&gt;&amp;nbsp;with driver &lt;STRONG&gt;ODBC Driver 17 for SQL Server&lt;/STRONG&gt;; due to some compatibility issues I cannot use &lt;EM&gt;&lt;STRONG&gt;pyodbc&lt;/STRONG&gt;&lt;/EM&gt;. The functionality should be same as pypyodbc&lt;/LI&gt;
&lt;LI&gt;additionally on the Linux AGs, to work with pypyodbc, I installed&amp;nbsp;&lt;STRONG&gt;unixODBC&lt;/STRONG&gt;, &lt;STRONG&gt;unixODBC-devel&lt;/STRONG&gt;, &lt;STRONG&gt;msodbcsql17&lt;/STRONG&gt;.&lt;/LI&gt;
&lt;LI&gt;connecting to the target MS SQL servers we use Windows authentication, by providing AD usernames and passwords&lt;/LI&gt;
&lt;LI&gt;the Python code uses the connection string as&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI-CODE lang="markup"&gt;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;"
)​&lt;/LI-CODE&gt;
&lt;P&gt;where UID is provided from the extension UI as "domain\username".&lt;/P&gt;
&lt;P&gt;It looks like the MS SQL servers consider the username and password as SQL Authentication, and not as Windows Authentication.&lt;BR /&gt;I have tried other properties defining the connection string &lt;STRONG&gt;&lt;EM&gt;conn_str&lt;/EM&gt;&lt;/STRONG&gt;, but still the code fails due to the exception.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;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 '&amp;lt;domain&amp;gt;\\&amp;lt;username&amp;gt;'.")&lt;/LI-CODE&gt;
&lt;P&gt;where&amp;nbsp;&lt;EM&gt;&amp;lt;domain&amp;gt;\&amp;lt;username&amp;gt;&lt;/EM&gt;&amp;nbsp;are the AD domain and username, provided by the extension UI, along with the password.&lt;BR /&gt;On the other hand, I tested the &lt;EM&gt;domain&lt;/EM&gt;, &lt;EM&gt;username&lt;/EM&gt; and &lt;EM&gt;password&lt;/EM&gt;, by creating a SQL Extension from, &lt;EM&gt;Custom Extensions Creator&lt;/EM&gt;, using &lt;STRONG&gt;NTLM Authentication&lt;/STRONG&gt;. I executed successfully this SQL extension that connected to MS SQL Server and retrieved the expected dataset from.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Chris&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;The UI configuration of &lt;STRONG&gt;my custom extension&lt;/STRONG&gt; (SDK)&lt;/TD&gt;
&lt;TD width="50%"&gt;The UI configuration of Dynatrace SQL extension&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="chris_cho_0-1767148915757.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/31376i829454109DBEA99C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="chris_cho_0-1767148915757.png" alt="chris_cho_0-1767148915757.png" /&gt;&lt;/span&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="50%"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="chris_cho_1-1767146430604.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/31375i3E639738212E307F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="chris_cho_1-1767146430604.png" alt="chris_cho_1-1767146430604.png" /&gt;&lt;/span&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
    <pubDate>Fri, 02 Jan 2026 09:33:43 GMT</pubDate>
    <dc:creator>chris_cho</dc:creator>
    <dc:date>2026-01-02T09:33:43Z</dc:date>
    <item>
      <title>Python Extension SDK fails connecting to MS SQL Server by using Windows Authentication - Linux AGs</title>
      <link>https://community.dynatrace.com/t5/Extensions/Python-Extension-SDK-fails-connecting-to-MS-SQL-Server-by-using/m-p/292331#M6981</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;I created a generic custom extension using Dynatrace Python Extensions SDK to extract some data from MS SQL Servers - database tables.&lt;BR /&gt;Below are some specs:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;ActiveGates are RHEL VMs with &lt;STRONG&gt;Python 3.6&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;for development I am using VS Code with &lt;STRONG&gt;Python 3.10&lt;/STRONG&gt;.&lt;/LI&gt;
&lt;LI&gt;connecting to MS SQL Server, I am using &lt;STRONG&gt;pypyodbc&lt;/STRONG&gt;&amp;nbsp;with driver &lt;STRONG&gt;ODBC Driver 17 for SQL Server&lt;/STRONG&gt;; due to some compatibility issues I cannot use &lt;EM&gt;&lt;STRONG&gt;pyodbc&lt;/STRONG&gt;&lt;/EM&gt;. The functionality should be same as pypyodbc&lt;/LI&gt;
&lt;LI&gt;additionally on the Linux AGs, to work with pypyodbc, I installed&amp;nbsp;&lt;STRONG&gt;unixODBC&lt;/STRONG&gt;, &lt;STRONG&gt;unixODBC-devel&lt;/STRONG&gt;, &lt;STRONG&gt;msodbcsql17&lt;/STRONG&gt;.&lt;/LI&gt;
&lt;LI&gt;connecting to the target MS SQL servers we use Windows authentication, by providing AD usernames and passwords&lt;/LI&gt;
&lt;LI&gt;the Python code uses the connection string as&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI-CODE lang="markup"&gt;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;"
)​&lt;/LI-CODE&gt;
&lt;P&gt;where UID is provided from the extension UI as "domain\username".&lt;/P&gt;
&lt;P&gt;It looks like the MS SQL servers consider the username and password as SQL Authentication, and not as Windows Authentication.&lt;BR /&gt;I have tried other properties defining the connection string &lt;STRONG&gt;&lt;EM&gt;conn_str&lt;/EM&gt;&lt;/STRONG&gt;, but still the code fails due to the exception.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;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 '&amp;lt;domain&amp;gt;\\&amp;lt;username&amp;gt;'.")&lt;/LI-CODE&gt;
&lt;P&gt;where&amp;nbsp;&lt;EM&gt;&amp;lt;domain&amp;gt;\&amp;lt;username&amp;gt;&lt;/EM&gt;&amp;nbsp;are the AD domain and username, provided by the extension UI, along with the password.&lt;BR /&gt;On the other hand, I tested the &lt;EM&gt;domain&lt;/EM&gt;, &lt;EM&gt;username&lt;/EM&gt; and &lt;EM&gt;password&lt;/EM&gt;, by creating a SQL Extension from, &lt;EM&gt;Custom Extensions Creator&lt;/EM&gt;, using &lt;STRONG&gt;NTLM Authentication&lt;/STRONG&gt;. I executed successfully this SQL extension that connected to MS SQL Server and retrieved the expected dataset from.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Chris&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;The UI configuration of &lt;STRONG&gt;my custom extension&lt;/STRONG&gt; (SDK)&lt;/TD&gt;
&lt;TD width="50%"&gt;The UI configuration of Dynatrace SQL extension&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="chris_cho_0-1767148915757.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/31376i829454109DBEA99C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="chris_cho_0-1767148915757.png" alt="chris_cho_0-1767148915757.png" /&gt;&lt;/span&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="50%"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="chris_cho_1-1767146430604.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/31375i3E639738212E307F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="chris_cho_1-1767146430604.png" alt="chris_cho_1-1767146430604.png" /&gt;&lt;/span&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Fri, 02 Jan 2026 09:33:43 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Extensions/Python-Extension-SDK-fails-connecting-to-MS-SQL-Server-by-using/m-p/292331#M6981</guid>
      <dc:creator>chris_cho</dc:creator>
      <dc:date>2026-01-02T09:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: Python Extension SDK fails connecting to MS SQL Server by using Windows Authentication - Linux AGs</title>
      <link>https://community.dynatrace.com/t5/Extensions/Python-Extension-SDK-fails-connecting-to-MS-SQL-Server-by-using/m-p/292719#M6992</link>
      <description>&lt;P&gt;I was recently in a similar situation. I ended up using pytds instead of pyodbc. The extension runs on Linux Active Gates. We have SQL Server running on both Windows and Linux servers. As I understand, pytds will work with Windows Authentication on Windows servers only, not Linux, although there may be a workaround. I am using sql authentication on both Windows and Linux servers and it works well for the most part.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jan 2026 22:50:42 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Extensions/Python-Extension-SDK-fails-connecting-to-MS-SQL-Server-by-using/m-p/292719#M6992</guid>
      <dc:creator>ChrisAtNG</dc:creator>
      <dc:date>2026-01-08T22:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: Python Extension SDK fails connecting to MS SQL Server by using Windows Authentication - Linux AGs</title>
      <link>https://community.dynatrace.com/t5/Extensions/Python-Extension-SDK-fails-connecting-to-MS-SQL-Server-by-using/m-p/292723#M6993</link>
      <description>&lt;P&gt;Thanks for your reply,&lt;/P&gt;&lt;P&gt;The Python libraries are accepted and provided within the company repo, thus I cannot use anyone.&lt;BR /&gt;The only library is working for me is pypyodbc being implemented for both Windows and Linux.&lt;BR /&gt;Additionally, based on the security policies the company doesn't allow SQL Server authentication, Windows authentication using AD service accounts.&lt;BR /&gt;However, I found a workaround using Windows authentication from Linux AGs, connecting to a Microsoft SQL Server, by impersonating the service account through Kerberos authentication at the time connecting to the SQL server.&lt;BR /&gt;This solution works for me, for now&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2026 00:33:40 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Extensions/Python-Extension-SDK-fails-connecting-to-MS-SQL-Server-by-using/m-p/292723#M6993</guid>
      <dc:creator>chris_cho</dc:creator>
      <dc:date>2026-01-09T00:33:40Z</dc:date>
    </item>
  </channel>
</rss>

