Site icon

Lesson Learned #328: Login failed for user ‘xyz’

This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Community Hub.

Today, we have a service request that our customer needs more information about a login failed ocurred in their databases. Following, I would like to share a recommendation about it.


If your application returned a login failed, for example, as below using SQL Server Management Studio:


Cannot connect to


Login failed for user 'XXX'. (.Net SqlClient Data Provider)

For help, click:

Server Name:
Error Number: 18456

Basically, if you enable SQL Auditing, you could find out what is the error code and the state that represents among other information what is the main cause. 


For example, using Home->SQL Databases->MyDB | Auditing in the portal I could obtain the audit logs selecting the option View Audit Logs



You will have the list of the current audit logs 




And finally, 



With the state number 8 you could see a wrong password - MSSQLSERVER_18456 - SQL Server | Microsoft Learn



Exit mobile version