Cannot generate SSPI context when connecting to SQL Server when a VPN is connected
23-May-1313 Leave a comment
We setup a VPN connection to another site, but then programs would not connect to SQL Server using Windows Authentication. We spent a fair bit of time trying to resolve this. Then found the solution, thanks to the following post:
After a lot of searching i found a good solution to the problem when using Windows login to a SQL server while on Win VPN giving the error: Cannot generate SSPI context.
Wanted to share it:
- Locate the .pbk file that contains the entry that you dial. Is either: C:\Users\<USERNAME>\AppData\Roaming\Microsoft\Network\Connections\Pbk or if connection is visible to all users: C:\ProgramData\Microsoft\Network\Connections\Pbk (hidden files may need to be disabled first through Organize -> Folder and search options)
- Open the file in Notepad using Open with…
- Locate the following entry: UseRasCredentials=1 Each VPN connection you have has a section marked with [<VPN connection name>]
- Modify the entry to the following: UseRasCredentials=0 Needs to be done for each VPN section for the connections having problems.
- On the File menu, click Save, and the click Exit.
“