Cannot generate SSPI context. (Microsoft SQL Server)
This is one of the most common error which we come across while connecting to SQL Server Instance. This generally happens when you are running the SQL Server Service under a Domain Service Account and No SPN Is registered for this Service Account for this SQL Server Instance.
"Cannot generate SSPI context. (Microsoft SQL Server)"
This is probably because of Kerboros Authentication.
Firstly go to machine to which you are getting the error.
Open Command Prompt and Check if any SPN is registered for SQL Server Service Account and use below command to check if SPN is registered or not.
SETSPN -L <service account name, without domain>
Ex. SETSPN -L MySQLServiceAccountName
If any SPN is registered you will get the list here. If not you need to Register the SPN. To set this you should be having Proper Previleges or you might request your AD Admin to do this for you.
Setting SPN to Default Instance:
SETSPN -A MSSQLSvc/<FQDN SQL Instance>:<engine port> <service account name, without domain>
Ex: SETSPN -A MSSQLSvc/MySQLServer.mydomain.com:1433 MySQLServiceAccountName
Setting SPN to Named Instance:
SETSPN -A MSSQLSvc/<FQDN SQL Instance>:<Instancename> <service account name, without domain>
Ex: SETSPN -A MSSQLSvc/MySQLServer.mydomain.com:MyInstanceName MySQLServiceAccountName
This is one of the resolution. Note, this applies only if SQL Server is running under a Domain Service Account and not any Local System Account