Fix “Cannot generate SSPI context” while connecting to SQL Server

Here is a problem resolved here – you can connect to MS SQL Server 2012 from the office, but when your try to connect from home over remote (in this case AVENTAIL) connection you would get an error message:

Cannot generate SSPI context“.

Once again, from the office you can connect to several SQL servers of different versions from 2008 to 2012 using SQL Server Management Studio (SSMS), but remotely one of the servers gives you the error about SSPI Context.  You are using Windows Authentication to connect.

Google search will reveal that error has something to do with domain user name not being properly recognized or registered on the server side.

Troubleshooting of this error seemed tough, because AVELTAIL support would tell me that this is a SQL problem, and Helpdesk support would say that this is an AVENTAIL problem.

Taking matters into my own hands, I decided to try to repeat all the installation steps and try to connect from any other laptop.  While doing that, I realized that because of Windows Authentication mode, I would either need to be logged in as “MY_WORK_DOMAIN\MY_WORK_USER” name to a new remote machine, or to find a way to run MS SQL Server Management Studio as that exact user.  Quickly I found a command to do just that: RUNAS.  But any attempt to run that command on a new PC would not change neither domain nor user on the SQL login screen.  But that prompted me to try this exact command on my work-issued laptop.  Instead of running SSMS.exe directly, I would run this command instead:

runas/netonly /user:Doman\User "C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\Ssms.exe"

Amazingly, this little trick finally allowed me to connect to the required server and avoid dreaded error message:


“Cannot generate SSPI context.”

SQL - Cannot generate SSPI context



(Visited 9,347 times, 1 visits today)

Be the first to comment

Your question, correction or clarification Ваш вопрос, поправка или уточнение