Tag Archives: sharepoint

Fix: SharePoint error Cannot generate SSPI context for SQL Server

When having a SharePoint setup you might get the following error in your event viewer.

Event ID 5586 – Unknown SQL Exception 0 occurred. Additional error information from SQL Server is included below. The target principal name is incorrect.  Cannot generate SSPI context.

The main culprit could be the lack of an SPN record. To do this, log into your SQL server as a domain administrator. Launch a command prompt as Administrator and type the following.

setspn -L Domain\UserName

Note: Replace Domain\UserName with the SharePoint user you are using for the services. If you are getting the ‘Cannot generate SSPI context’ you should not see an entry for the SQL server in the command we just executed i.e. you SharePoint farm service user.  Run the command below to add the SPN record for the SQL server

setspn -A MSSQLSvc/SQLServerName.Domain.com:1433 Domain\UserName

Note: Replace SQLServerName.Domain.com with the full FQDN name of your SQL Server. If you are using SQL AlwaysOn Availability or cluster, please enter the full FQDN of the SQL listener. Also change the Domain\Username with the SharePoint service user.

Once executed, run the first command we executed and make sure that you have the SQL SPN record for the username.

This should fix the Event ID 5586

(4845)