Bug #115934 MySql Connector .NET - Windows Authentication Failure
Submitted: 26 Aug 2024 17:54 Modified: 30 Aug 2024 6:21
Reporter: Jeff Danner Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:9.0.0 OS:Windows
Assigned to: CPU Architecture:Any
Tags: Windows Authentication

[26 Aug 2024 17:54] Jeff Danner
Description:
I cannot connect to MySql/MariaDB with Windows Authentication using MySql Connector (MySql.Data v9.0.0).

I can connect with the same Windows AD service account using HeidiSQL.

How to repeat:
Connecting to MySql/MaraDB with Windows Authentication. I created a simple test console app in C#.
MySqlConnectionStringBuilder creates invalid connection string; "Integrated Security=True" not "IntegratedSecurity=yes" required per the documentation.

I attempted to just make the connection string as a string loteral:  server=MyServer;database=MyDatabase;IntegratedSecurity=yes;port=3306

I passed that into the MySqlConnection constructor:
using (MySqlConnection connection = new MySqlConnection("server=MyServer;database=MyDatabase;IntegratedSecurity=yes;port=3306"))
{
 Console.WriteLine($"Connection object connection string: {connection.ConnectionString}");
connection.Open();
}

OUTPUT:

Connection object connection string: server=MyServerdatabase=MyDatabase;Integrated Security=True;port=3306

Authentication to host 'MyServerdatabase' for user 'MyUser' using method 'mysql_native_password' failed with message: Access denied for user 'auth_windows'@'MyLocalServer' (using password: NO) 

Yet I can connect with the Windws AD account using HeidiSQL on the test server, logged in as the AD service account

Suggested fix:
Change MySqlConnectionStringBuilder to generate the correct connection string and change the MySqlConnection to NOT alter a valid connection string
[28 Aug 2024 9:13] MySQL Verification Team
Hello Jeff Danner,

Thank you for the bug report and feedback.
Could you please provide a repeatable test case (sample console app in c# which manifest the issue - please make it as private if you prefer) to reproduce this issue at our end? Thank you.

Regards,
Umesh
[28 Aug 2024 15:25] MySQL Verification Team
Thank you for providing requested details.

regards,
Umesh
[30 Aug 2024 6:21] MySQL Verification Team
Thank you for the test case.