Search code examples
azure-hybrid-connections

Azure Hybrid Connection SSPI handshake failed


I have an instance of Azure Hybrid Connections running on a server where SQL Server is installed.

I hosted an WebApp on azure, set up the hybrid connection and I'm consistently getting the same SSPI Handshake error

SSPI handshake failed with error code 0x8009030c, state 14 while establishing a connection with integrated security; the connection has been closed. Reason: AcceptSecurityContext failed. The operating system error code indicates the cause of failure. The logon attempt failed [CLIENT: 1x.xx.xx.xxx]

As described here I added the clients ip in the local security policy.

I also tried adding the DisableLoopbackCheck=1 in HKLM\System\CurrentControlSet\Control\LSA, but it didn't help either.

Do I have to fix it on a database level perhaps?


Solution

  • As per https://github.com/Huachao/azure-content/blob/master/articles/app-service-web/web-sites-hybrid-connection-connect-on-premises-sql-server.md

    [AZURE.NOTE] To ensure that your application uses the database that you created in SQL Server Express, and not the one in Visual Studio's default LocalDB, it is important that you complete this step before running your project.

    Edit the connectionStrings section to point to the SQL Server database on your local machine, following the syntax in the following example:

    I added user credentials to my connection string in appsettings.json and it now works.