Repeated login failures on an Azure SQL Virtual Machine

Published Jan 15 2019 04:54 PM 302 Views
Microsoft
First published on MSDN on Mar 23, 2016

Lately, a user called in for support because he saw repeated failures like below, flooding the Windows event logs and errorlogs on Azure Virtual machines they have in their environment.


[Error] CredentialManagementOtherExceptionThrown: Login failed for user 'CONTOSO\SQLSERVER-0$'.
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at Microsoft.SqlServer.Management.CredentialManagement.CredentialManagementHelpers.IsSqlSupportedVersion()
at Microsoft.SqlServer.Management.CredentialManagement.CredentialManagementHelpers.CheckIfCredentialManagementSupported()

2016-03-22 19:37:36.99 Logon       Error: 18456, Severity: 14, State: 5.
2016-03-22 19:37:36.99 Logon       Login failed for user 'CONTOSO\SQLSERVER-0$'. Reason: Could not find a login matching the name provided. [CLIENT: <local machine>]

From looking at the error, we can conclude a couple of things.  First, the login attempt came from local machine on that computer.  Secondly, the login was in format of doamin\computername$.   This tell you that some service running under a Windows Virtual Account was trying to access SQL Server.   For more references about virtual accounts, see https://msdn.microsoft.com/en-us/library/ms143504.aspx and https://technet.microsoft.com/en-us/library/dd548356(v=ws.10).aspx .

This user did do some security tightening and removed “unnecessary” local accounts, one of which was the service account for SQLIaasAgent .   SQLIaasAgent is configured as a service called SQLIaaSExtension running with NT Service\SQLIaasExtension.  It needs to login regularly to check for automated backup.   This service account requires sysadmin rights.

After adding “NT Service\SQLIaasExtension” and grant it sysadmin rights, the issue went away.  if you don’t want automated backup and patching, you can choose to disable or remove SQLIaaSAgent to avoid the error as well.

Jack Li |Senior Escalation Engineer | Microsoft SQL Server

twitter | pssdiag | Sql Nexus

%3CLINGO-SUB%20id%3D%22lingo-sub-318704%22%20slang%3D%22en-US%22%3ERepeated%20login%20failures%20on%20an%20Azure%20SQL%20Virtual%20Machine%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-318704%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3E%20First%20published%20on%20MSDN%20on%20Mar%2023%2C%202016%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CP%3ELately%2C%20a%20user%20called%20in%20for%20support%20because%20he%20saw%20repeated%20failures%20like%20below%2C%20flooding%20the%20Windows%20event%20logs%20and%20errorlogs%20on%20Azure%20Virtual%20machines%20they%20have%20in%20their%20environment.%3C%2FP%3E%0A%20%20%3CP%3E%3CBR%20%2F%3E%20%5BError%5D%20CredentialManagementOtherExceptionThrown%3A%20Login%20failed%20for%20user%20'CONTOSO%5CSQLSERVER-0%24'.%20%3CBR%20%2F%3E%20at%20System.Data.SqlClient.SqlInternalConnection.OnError(SqlException%20exception%2C%20Boolean%20breakConnection%2C%20Action%601%20wrapCloseInAction)%20%3CBR%20%2F%3E%20at%20System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject%20stateObj%2C%20Boolean%20callerHasConnectionLock%2C%20Boolean%20asyncClose)%20%3CBR%20%2F%3E%20at%20System.Data.SqlClient.TdsParser.TryRun(RunBehavior%20runBehavior%2C%20SqlCommand%20cmdHandler%2C%20SqlDataReader%20dataStream%2C%20BulkCopySimpleResultSet%20bulkCopyHandler%2C%20TdsParserStateObject%20stateObj%2C%20Boolean%26amp%3B%20dataReady)%20%3CBR%20%2F%3E%20at%20System.Data.SqlClient.TdsParser.Run(RunBehavior%20runBehavior%2C%20SqlCommand%20cmdHandler%2C%20SqlDataReader%20dataStream%2C%20BulkCopySimpleResultSet%20bulkCopyHandler%2C%20TdsParserStateObject%20stateObj)%20%3CBR%20%2F%3E%20at%20System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean%20enlistOK)%20%3CBR%20%2F%3E%20at%20System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo%20serverInfo%2C%20String%20newPassword%2C%20SecureString%20newSecurePassword%2C%20Boolean%20ignoreSniOpenTimeout%2C%20TimeoutTimer%20timeout%2C%20Boolean%20withFailover)%20%3CBR%20%2F%3E%20at%20System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo%20serverInfo%2C%20String%20newPassword%2C%20SecureString%20newSecurePassword%2C%20Boolean%20redirectedUserInstance%2C%20SqlConnectionString%20connectionOptions%2C%20SqlCredential%20credential%2C%20TimeoutTimer%20timeout)%20%3CBR%20%2F%3E%20at%20System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer%20timeout%2C%20SqlConnectionString%20connectionOptions%2C%20SqlCredential%20credential%2C%20String%20newPassword%2C%20SecureString%20newSecurePassword%2C%20Boolean%20redirectedUserInstance)%20%3CBR%20%2F%3E%20at%20System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity%20identity%2C%20SqlConnectionString%20connectionOptions%2C%20SqlCredential%20credential%2C%20Object%20providerInfo%2C%20String%20newPassword%2C%20SecureString%20newSecurePassword%2C%20Boolean%20redirectedUserInstance%2C%20SqlConnectionString%20userConnectionOptions%2C%20SessionData%20reconnectSessionData)%20%3CBR%20%2F%3E%20at%20System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions%20options%2C%20DbConnectionPoolKey%20poolKey%2C%20Object%20poolGroupProviderInfo%2C%20DbConnectionPool%20pool%2C%20DbConnection%20owningConnection%2C%20DbConnectionOptions%20userOptions)%20%3CBR%20%2F%3E%20at%20System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool%20pool%2C%20DbConnection%20owningObject%2C%20DbConnectionOptions%20options%2C%20DbConnectionPoolKey%20poolKey%2C%20DbConnectionOptions%20userOptions)%20%3CBR%20%2F%3E%20at%20System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection%20owningObject%2C%20DbConnectionOptions%20userOptions%2C%20DbConnectionInternal%20oldConnection)%20%3CBR%20%2F%3E%20at%20System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection%20owningObject%2C%20DbConnectionOptions%20userOptions%2C%20DbConnectionInternal%20oldConnection)%20%3CBR%20%2F%3E%20at%20System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection%20owningObject%2C%20UInt32%20waitForMultipleObjectsTimeout%2C%20Boolean%20allowCreate%2C%20Boolean%20onlyOneCheckConnection%2C%20DbConnectionOptions%20userOptions%2C%20DbConnectionInternal%26amp%3B%20connection)%20%3CBR%20%2F%3E%20at%20System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection%20owningObject%2C%20TaskCompletionSource%601%20retry%2C%20DbConnectionOptions%20userOptions%2C%20DbConnectionInternal%26amp%3B%20connection)%20%3CBR%20%2F%3E%20at%20System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection%20owningConnection%2C%20TaskCompletionSource%601%20retry%2C%20DbConnectionOptions%20userOptions%2C%20DbConnectionInternal%20oldConnection%2C%20DbConnectionInternal%26amp%3B%20connection)%20%3CBR%20%2F%3E%20at%20System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection%20outerConnection%2C%20DbConnectionFactory%20connectionFactory%2C%20TaskCompletionSource%601%20retry%2C%20DbConnectionOptions%20userOptions)%20%3CBR%20%2F%3E%20at%20System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource%601%20retry)%20%3CBR%20%2F%3E%20at%20System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource%601%20retry)%20%3CBR%20%2F%3E%20at%20System.Data.SqlClient.SqlConnection.Open()%20%3CBR%20%2F%3E%20at%20Microsoft.SqlServer.Management.CredentialManagement.CredentialManagementHelpers.IsSqlSupportedVersion()%20%3CBR%20%2F%3E%20at%20Microsoft.SqlServer.Management.CredentialManagement.CredentialManagementHelpers.CheckIfCredentialManagementSupported()%3C%2FP%3E%0A%20%20%3CP%3E2016-03-22%2019%3A37%3A36.99%20Logon%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Error%3A%2018456%2C%20Severity%3A%2014%2C%20State%3A%205.%20%3CBR%20%2F%3E%202016-03-22%2019%3A37%3A36.99%20Logon%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Login%20failed%20for%20user%20'CONTOSO%5CSQLSERVER-0%24'.%20Reason%3A%20Could%20not%20find%20a%20login%20matching%20the%20name%20provided.%20%5BCLIENT%3A%20%3CLOCAL%20machine%3D%22%22%3E%5D%20%3CBR%20%2F%3E%3C%2FLOCAL%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EFrom%20looking%20at%20the%20error%2C%20we%20can%20conclude%20a%20couple%20of%20things.%26nbsp%3B%20First%2C%20the%20login%20attempt%20came%20from%20local%20machine%20on%20that%20computer.%26nbsp%3B%20Secondly%2C%20the%20login%20was%20in%20format%20of%20doamin%5Ccomputername%24.%26nbsp%3B%26nbsp%3B%20This%20tell%20you%20that%20some%20service%20running%20under%20a%20Windows%20Virtual%20Account%20was%20trying%20to%20access%20SQL%20Server.%26nbsp%3B%26nbsp%3B%20For%20more%20references%20about%20virtual%20accounts%2C%20see%20%3CA%20href%3D%22https%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fms143504.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%20https%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fms143504.aspx%20%3C%2FA%3E%20and%20%3CA%20href%3D%22https%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fdd548356(v%3Dws.10).aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%20https%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fdd548356(v%3Dws.10).aspx%20%3C%2FA%3E%20.%3C%2FP%3E%0A%20%20%3CP%3EThis%20user%20did%20do%20some%20security%20tightening%20and%20removed%20%E2%80%9Cunnecessary%E2%80%9D%20local%20accounts%2C%20one%20of%20which%20was%20the%20service%20account%20for%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fdocumentation%2Farticles%2Fvirtual-machines-sql-server-agent-extension%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%20SQLIaasAgent%20%3C%2FA%3E%20.%26nbsp%3B%26nbsp%3B%20SQLIaasAgent%20is%20configured%20as%20a%20service%20called%20SQLIaaSExtension%20running%20with%20NT%20Service%5CSQLIaasExtension.%26nbsp%3B%20It%20needs%20to%20login%20regularly%20to%20check%20for%20automated%20backup.%26nbsp%3B%26nbsp%3B%20This%20service%20account%20requires%20sysadmin%20rights.%3C%2FP%3E%0A%20%20%3CP%3EAfter%20adding%20%E2%80%9CNT%20Service%5CSQLIaasExtension%E2%80%9D%20and%20grant%20it%20sysadmin%20rights%2C%20the%20issue%20went%20away.%26nbsp%3B%20if%20you%20don%E2%80%99t%20want%20automated%20backup%20and%20patching%2C%20you%20can%20choose%20to%20disable%20or%20remove%20SQLIaaSAgent%20to%20avoid%20the%20error%20as%20well.%3C%2FP%3E%0A%20%20%3CP%3EJack%20Li%20%7CSenior%20Escalation%20Engineer%20%7C%20Microsoft%20SQL%20Server%3C%2FP%3E%0A%20%20%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftwitter.com%2Fjackli8898%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Etwitter%20%3C%2FA%3E%20%7C%20%3CA%20href%3D%22http%3A%2F%2Fdiagmanager.codeplex.com%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%20pssdiag%20%3C%2FA%3E%20%7C%20%3CA%20href%3D%22http%3A%2F%2Fsqlnexus.codeplex.com%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%20Sql%20Nexus%3C%2FA%3E%3C%2FP%3E%0A%20%0A%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-318704%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20Mar%2023%2C%202016%20Lately%2C%20a%20user%20called%20in%20for%20support%20because%20he%20saw%20repeated%20failures%20like%20below%2C%20flooding%20the%20Windows%20event%20logs%20and%20errorlogs%20on%20Azure%20Virtual%20machines%20they%20have%20in%20their%20environment.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-318704%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Econnectivity%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESecurity%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Version history
Last update:
‎Jan 15 2019 04:54 PM
Updated by: