title: SetSPN unable to locate account
body: <p>I have SQL Server 2014 installed on a Windows Server 2012 R2, which is also an AD DC. When I try to connect to it using SQL Server Management Studio (SSMS) from a client desktop on the same local domain, I got this error message:</p>
  
  <pre><code>The target principal name is incorrect. Cannot generate SSPI context. (Microsoft SQL Server)
  </code></pre>
  
  <p>So following other posts on the same issue, I downloaded Kerberos Configuration Manager on the SQL server, which found 2 Misplaced SPN. The SPN Script commands proposed by the Kerberos Configuration Manager are as follows:</p>
  
  <pre><code>SetSPN -d "MSSQLSvc/SERVERNAME.internal.domain.com" "internal\SERVERNAME$"
  SetSPN -s "MSSQLSvc/SERVERNAME.internal.domain.com" "DOMAIN\SERVERNAME$"
  </code></pre>
  
  <p>But when I tried to run the first command in cmd on the server (the "SetSPN -d" one), I got this error: </p>
  
  <pre><code>FindDomainForAccount: Call to DsGetDcNameWithAccountW failed with return value 0x0000054B
  Unable to locate account SERVERNAME$
  </code></pre>
  
  <p>I'm not sure how to move forward from here. Googling around hasn't turned out the right answer. Please help. The questions are:</p>
  
  <p>1) Is the misplaced SPN the culprit? If so, how to correct?</p>
  
  <p>2) If not, how can I connect to SQL Server from a client desktop on the same local domain, using Windows authentication?</p>