Closed croblesm closed 3 weeks ago
mssql: Failed to connect: System.ArgumentNullException: Value cannot be null. (Parameter 'User ID') at Microsoft.Data.SqlClient.SqlConnectionStringBuilder.SetValue(String keyword, String value) at Microsoft.Data.SqlClient.SqlConnectionStringBuilder.set_UserID(String value) at Microsoft.SqlTools.ServiceLayer.Connection.ConnectionService.CreateConnectionStringBuilder(ConnectionDetails connectionDetails, Boolean forceDisablePooling) in /_/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs:line 1419 at Microsoft.SqlTools.ServiceLayer.Connection.ConnectionService.BuildConnectionString(ConnectionDetails connectionDetails, Boolean forceDisablePooling) in /_/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs:line 1372 at Microsoft.SqlTools.ServiceLayer.Connection.ConnectionService.TryOpenConnection(ConnectionInfo connectionInfo, ConnectParams connectionParams) in /_/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs:line 691
This issue actually ended up having nothing to do with Entra passwordless auth. The bug was that the authentication type from the Parameters input was still being set even though the user had entered a connection string. SqlToolsService saw "SqlAuth" set and proceeded to do a bunch of extra validation, and failed because User ID
- which is necessary for SqlAuth - wasn't set.
If anyone finds that Entra passwordless auth is not working, please open a new bug.
I'm trying to connect an existing Azure SQL Database by using copying the ADO.NET (Microsoft Entra passwordless authentication) connection string, but it fails with the
Value cannot be null. (Parameter 'User ID')
error.This is the connection string I'm copying/pasting:
Server=tcp:<MyServer>.database.windows.net,1433;Initial Catalog=<MyDatabase>;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;Authentication="Active Directory Default";
Error from Connection Dialog: