Tuesday, May 20, 2014

Microsoft CRM 2011: SecurityNegotiationException: A call to SSPI failed

Background

Recently, I was tasked with distributing the architecture of an existing Microsoft Dynamics CRM 2011 environment so that CRM would have a dedicated SQL server.  The original environment had everything running on the same machine.  Over time, the system performance had been steadily declining after the client had added new applications and organizations to CRM.

Problem

After I had installed and configured CRM on Server A and installed and configured SQL with SSRS and Microsoft Dynamics CRM Reporting Extensions for SQL Server on Server B, I opened the CRM web client and began testing to make sure everything was functioning correctly.  I noticed that everything functioned except for SSRS reports that were built using the Report Wizard.  I simply created a test report on the accounts entity and this would fail giving me the generic (rsProcessingAborted) error.

I checked for this error in the Reporting Services logs and found a little more detail:
Microsoft.Crm.CrmException: An unexpected error occurred.
System.ServiceModel.Security.SecurityNegotiationException: A call to SSPI failed, see inner exception.
System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception.
System.ComponentModel.Win32Exception: The target principal name is incorrect ---> Microsoft.Crm.Reporting.DataExtensionShim.Common.ReportExecutionException: An unexpected error occurred. ---> Microsoft.Crm.Reporting.DataExtensionShim.Common.ReportExecutionException: A call to SSPI failed, see inner exception. ---> Microsoft.Crm.Reporting.DataExtensionShim.Common.ReportExecutionException: A call to SSPI failed, see inner exception. ---> Microsoft.Crm.Reporting.DataExtensionShim.Common.ReportExecutionException: The target principal name is incorrect

Solution

The SQL server was missing a HTTP spn that it needs in order to run FetchXML queries from CRM.  I found a great description and solution to the problem here: http://support.microsoft.com/kb/2590774/en-us.

First, I ran the following setspn commands from the SQL server:
setspn -a HTTP/CRMSQLServerName myDomain\CRMAppPoolServiceAccount
setspn -a HTTP/CRMSQLServerFullyQualifiedDomainName myDomain\CRMAppPoolServiceAccount

Then, I set the useAppPoolCredentials value to True for the Microsoft CRM Website on the CRM server.