microsoft / azuredatastudio

Azure Data Studio is a data management and development tool with connectivity to popular cloud and on-premises databases. Azure Data Studio supports Windows, macOS, and Linux, with immediate capability to connect to Azure SQL and SQL Server. Browse the extension library for more database support options including MySQL, PostgreSQL, and MongoDB.
https://learn.microsoft.com/sql/azure-data-studio
MIT License
7.54k stars 896 forks source link

Login for blank password leads to an error upon connecting with no way to recover #25491

Open smartguest opened 6 months ago

smartguest commented 6 months ago

Attempting to connect to a SQL Server with a SQL Login that has no password works in SSMS, but currently in ADS, it throws a non specific error and refuses to load the tree. This was encountered while investigating https://github.com/microsoft/azuredatastudio/issues/25048 and may be related to it.

LoginWithBlankPassword

cheenamalhotra commented 6 months ago

I'm able to connect just fine, I tested with ADS 1.48.0, created a new profile. Do you have any error logs you can share?

smartguest commented 6 months ago

2-SQL Tools Service.log

[Trace - 3:16:58 PM] Received notification 'connection/complete'. Params: { "ownerUri": "dashboard:providerName:MSSQL|connectionName:TestLogin|database:master|server:ALEXNEWDESKTOP\SQLEXPRESS|trustServerCertificate:true|user:testlogin|groupId:C777F06B-202E-4480-B475-FA416154D458", "connectionId": null, "messages": "Microsoft.Data.SqlClient.SqlException (0x80131904): Login failed for user 'testlogin'.\r\n at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction)\r\n at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)\r\n at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)\r\n at Microsoft.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)\r\n at Microsoft.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)\r\n at Microsoft.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)\r\n at Microsoft.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)\r\n at Microsoft.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)\r\n at Microsoft.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String accessToken, DbConnectionPool pool)\r\n at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)\r\n at Microsoft.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)\r\n at Microsoft.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)\r\n at Microsoft.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)\r\n at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)\r\n at Microsoft.Data.ProviderBase.DbConnectionPool.WaitForPendingOpen()\r\n--- End of stack trace from previous location ---\r\n at Microsoft.Data.SqlClient.SqlRetryLogicProvider.ExecuteAsync(Object sender, Func1 function, CancellationToken cancellationToken)\r\n at Microsoft.Data.SqlClient.SqlRetryLogicProvider.ExecuteAsync(Object sender, Func`1 function, CancellationToken cancellationToken)\r\n at Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection.ReliableSqlConnection.<>c__DisplayClass30_0.<b_0>d.MoveNext() in //src/Microsoft.SqlTools.ManagedBatchParser/ReliableConnection/ReliableSqlConnection.cs:line 319\r\n--- End of stack trace from previous location ---\r\n at Microsoft.SqlTools.ServiceLayer.Connection.ConnectionService.TryOpenConnection(ConnectionInfo connectionInfo, ConnectParams connectionParams) in /_/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs:line 712\r\nClientConnectionId:ff2e6fef-0e3d-4438-9e0f-b5fe9071734c\r\nError Number:18456,State:1,Class:14", "errorMessage": "Login failed for user 'testlogin'.", "errorNumber": 18456, "serverInfo": null, "connectionSummary": null, "type": "Default", "isSupportedVersion": null, "unsupportedVersionMessage": null, "serverConnectionId": null }

This only started happening after I made a change to STS for debugging which I quickly reverted, but this is happening on my non debug ADS installations as well.

smartguest commented 6 months ago

This is me logging in with SSMS, showing SQL Logins are supported: SqlServerLoginBlank

smartguest commented 6 months ago

Adding a password to the login makes the login work, but changing it to a blank password again breaks it.

Boxser1987 commented 6 months ago

Attempting to connect to a SQL Server with a SQL Login that has no password works in SSMS, but currently in ADS, it throws a non specific error and refuses to load the tree. This was encountered while investigating #25048 and may be related to it.

LoginWithBlankPassword LoginWithBlankPassword

smartguest commented 6 months ago

Reinstalling ADS and recreating the login fixed the issue for me, still if another user has encountered it, this might be worth investigating.