SQL SERVER - Could Not Register Service Principal Name Persists - Notes from the Field #105 - SQL Authority with Pinal Dave (2024)

Pinal Dave

SQL

9 Comments

[Note from Pinal]:In this episode of the Notes from the Field series database expert Ryan Adamsexplains a very critical error user receive when registering service principals. Ryan is one guy whospends more time with real world issues with SQL Server than anything else. He has mastered the art of resolving complex errors and document them so easily that one can’t find anywhere else. In this blog post Ryan addresses a very interesting error related to Service Principal Name. Read the experience of Ryan in herown words.

Have you ever seen the error below in your SQL Server log shortly after startup? You’ll actually see two of them and you can see the difference between them in the screen shot, but here is the text.

The SQL Server Network Interface library could not register the Service Principal Name (SPN) [ MSSQLSvc/Node1.stars.com:1433 ] for the SQL Server Service. Windows return code: 0x2098, state: 15. Failure to register a SPN might cause integrated authentication to use NTLM instead of Kerberos. This is an informational message. Further action is only required if Kerberos authentication is required by authentication policies and if the SPN has not been manually registered.

SQL SERVER - Could Not Register Service Principal Name Persists - Notes from the Field #105 - SQL Authority with Pinal Dave (1)

So what causes this error and how can you fix it? The first thing to note is that it is an informational message and not actually an error. There are two scenarios in which you will see this message.

  1. The first scenario is what you see right out of the box. SQL Server does not have the rights on a domain service account to register Service Principal Names (SPNs). The description we see here is very clear in telling us that SQL Server could not register the required SPNs. It even tells us the exact SPN syntax it attempted to register. If you want to use Kerberos you have to register the SPNs manually or give the service account the right to perform the change itself. If you decided to register them manually, then now is a good time to write down the SPNs from the description.
  2. The second scenario is a weird one that throws people off. If you choose to manually register the SPNs on the service account and restart SQL Server, you’ll still see the same message in the log. Now why in the world would this message even show up if you already registered the SPNs? In fact, many folks will see this message and assume they are not using Kerberos, because the message clearly states that it could not register the SPNs. The assumption is usually that they got the SPN syntax wrong or that the SPNs never got registered.

Just for kicks, let’s jump back over to my test server and take a look at the current connections. Most folks will add a WHERE clause to the following query to just look at their current connection, but I’m going to caution you about that. If you’re on the server itself, you won’t get accurate results because you end up using Named Pipes unless it’s disabled. We are looking to see if there are any Kerberos connections at all so we don’t want to filter the result set.

SELECT * FROM sys.dm_exec_connections--WHERE session_id = @@SPID

SQL SERVER - Could Not Register Service Principal Name Persists - Notes from the Field #105 - SQL Authority with Pinal Dave (2)

Well that’s an interesting result, huh? I clearly have Kerberos connections despite the message I keep getting in the SQL Server log. So why is that? Well it comes down to the semantics of the message. The message said it couldn’t register the SPNs and that’s true. It couldn’t register them because you already did it. So if you ever see this message, make sure you go look at your connections first (using the above query) to see if it is something you need to address or not. If you see KERBEROS in the auth_scheme column, then you are all set.

If you want the message to go away completely, there is only one way to do that. You have to give the account running the SQL Server service the permissions to change its own SPNs. You can do that by opening the properties of the account and heading to the security tab. You will find an account in the account list called SELF. Grant that account “Write to Public Information”, restart the SQL Server service, and the message will disappear. Now you’ll see a new message stating that SQL Server was able to successfully register the required SPNs.

Reference:Pinal Dave (https://blog.sqlauthority.com)

Notes from the Field, SQL Error Messages, SQL Function, SQL Server

Previous PostSQL SERVER – XEvents to Find Cardinality Estimation IssuesNext PostSQL SERVER – 2016 – Opening JSON with OPENJSON()

Related Posts

SQL SERVER – Unable to Bring Resource Online – Error – Could Not Find Any IP Address that this SQL Server Instance Depends Upon

SQL SERVER – Fix – Error: 1060 The number of rows provided for a TOP or FETCH clauses row count parameter must be an integer

How to Force Index on a SQL Server Query? – Interview Question of the Week #281

9 Comments. Leave new

  • SQL SERVER - Could Not Register Service Principal Name Persists - Notes from the Field #105 - SQL Authority with Pinal Dave (6)

    Dave Percy

    June 30, 2016 10:58 pm

    I found that the above query with the where clause, “where session_id=@@spid”, only show my own session, which returned NTLM. Modified like the query below actually returned what I was looking for.

    select * from sys.dm_exec_connections
    where auth_scheme = ‘KERBEROS’

    Reply
  • SQL SERVER - Could Not Register Service Principal Name Persists - Notes from the Field #105 - SQL Authority with Pinal Dave (7)

    James Bailey

    May 20, 2017 3:45 am

    Where is this? What interface?

    “You can do that by opening the properties of the account and heading to the security tab. You will find an account in the account list called SELF. “

    Reply
    • SQL SERVER - Could Not Register Service Principal Name Persists - Notes from the Field #105 - SQL Authority with Pinal Dave (8)

      Pinal Dave

      May 22, 2017 5:34 pm

      You have to do that do domain controller – Domain User.

      Reply
  • SQL SERVER - Could Not Register Service Principal Name Persists - Notes from the Field #105 - SQL Authority with Pinal Dave (9)

    sathish chandra

    April 21, 2018 3:41 am

    Hi Pinal, i got same error:
    The SQL Server Network Interface library could not register the Service Principal Name (SPN) [ xxxxxxxxxxxx ] for the SQL Server service. Windows return code: 0x2098, state: 15. Failure to register a SPN might cause integrated authentication to use NTLM instead of Kerberos. This is an informational message. Further action is only required if Kerberos authentication is required by authentication policies and if the SPN has not been manually registered.

    But when i ran above query no ‘KERBEROS’ found .

    we are getting below errors as well.
    Could not connect because the maximum number of ‘1’ dedicated administrator connections already exists. Before a new connection can be made, the existing dedicated administrator connection must be dropped, either by logging off or ending the process.

    Error: 17810, Severity: 20, State: 2.

    Can you please provide solution

    Reply
  • SQL SERVER - Could Not Register Service Principal Name Persists - Notes from the Field #105 - SQL Authority with Pinal Dave (11)

    Sanketh Salian

    November 25, 2019 11:32 am

    How do we go about SPN registration in case of a Always on Enabled server. Do we register the individual server or we register the listener Name. Anyone, kindly share your thoughts.

    Reply
  • SQL SERVER - Could Not Register Service Principal Name Persists - Notes from the Field #105 - SQL Authority with Pinal Dave (12)

    Chintan Vithlani

    December 26, 2019 9:59 am

    HI Pinal,
    we have registered SPN against service account in our AD but still error persists, also checked in dm_exec_connections auth_scheme is SQL for all the entries present. Can you Please help further

    2019-12-23 14:03:52.98 Server The SQL Server Network Interface library could not register the Service Principal Name (SPN) [ MSSQLSvc/ABC.global.PQR.com:SQLEXPRESS ] for the SQL Server service. Windows return code: 0x21c7, state: 15. Failure to register a SPN might cause integrated authentication to use NTLM instead of Kerberos. This is an informational message. Further action is only required if Kerberos authentication is required by authentication policies and if the SPN has not been manually registered.
    2019-12-23 14:03:52.98 Server The SQL Server Network Interface library could not register the Service Principal Name (SPN) [ MSSQLSvc/ABC.global.PQR.com:portno ] for the SQL Server service. Windows return code: 0x21c7, state: 15. Failure to register a SPN might cause integrated authentication to use NTLM instead of Kerberos. This is an informational message. Further action is only required if Kerberos authentication is required by authentication policies and if the SPN has not been manually registered.

    Reply
  • SQL SERVER - Could Not Register Service Principal Name Persists - Notes from the Field #105 - SQL Authority with Pinal Dave (13)

    georgey

    March 15, 2023 9:52 am

    thank you, this helped me alot

    Reply
  • SQL SERVER - Could Not Register Service Principal Name Persists - Notes from the Field #105 - SQL Authority with Pinal Dave (14)

    Nas

    March 6, 2024 3:21 pm

    Always made my work easy with the tips

    Reply

Leave a Reply

Pinal Dave is an SQL Server Performance Tuning Expert and independent consultant with over 22 years of hands-on experience. He holds a Masters of Science degree and numerous database certifications.

Pinal has authored 13 SQL Server database books and 74 Pluralsight courses. To freely share his knowledge and help others build their expertise, Pinal has also written more than 5,700 database tech articles on his blog at https://blog.sqlauthority.com.

Pinal is an experienced and dedicated professional with a deep commitment to flawless customer service. If you need help with any SQL Server Performance Tuning Issues, please feel free to reach out at pinal@sqlauthority.com.

Pinal is also a CrossFit Level 1 Trainer (CF-L1) and CrossFit Level 2 Trainer (CF-L2).

Nupur Dave is a social media enthusiast and an independent consultant. She primarily focuses on the database domain, helping clients build short and long-term multi-channel campaigns to drive leads for their sales pipeline.

Is your SQL Server running slow and you want to speed it up without sharing server credentials? In my Comprehensive Database Performance Health Check, we can work together remotely and resolve your biggest performance troublemakers in less than 4 hours.

Once you learn my business secrets, you will fix the majority of problems in the future.

Have you ever opened any PowerPoint deck when you face SQL Server Performance Tuning emergencies? SQL Server Performance Tuning Practical Workshop is my MOST popular training with no PowerPoint presentations and 100% practical demonstrations.

Essentially I share my business secrets to optimize SQL Server performance.

SQL SERVER - Could Not Register Service Principal Name Persists - Notes from the Field #105 - SQL Authority with Pinal Dave (2024)

FAQs

How to fix spn issues in SQL Server? ›

Resolution
  1. Run the SETSPN -L domain\svcacct command to list SPNs on the SQL Server service account.
  2. Run the SETSPN -Q spnName command to learn which service account the SPN is registered on.
  3. Run the SETSPN -D command to remove the SPN from the service.
  4. Run the SETSPN -A command to add the SPN to the service.
May 29, 2024

How to fix the target principal name is incorrect in SQL Server? ›

Check the SPN (Service Principal Name) Configuration

The SPN is a unique identifier for a SQL Server instance. If the SPN is invalid, it can cause the “Target Principal Name is Incorrect” error. You can use the SETSPN tool to check the SPN configuration and re-register the SPN if necessary.

How to check if SQL Server is using Kerberos authentication? ›

If output will be kerberos ,log on process is by kerberos authentication. Start->Run->gpedit. msc->Computer Configuration, Windows Settings, Security Settings, Local Policies, Audit Policy, "Audit logon events". Check the "Success" and "Failure" check boxes.

How to check spn registered or not in SQL Server? ›

To check the SPNs that are registered for a specific computer using that computer, you can run the following commands from a command prompt: setspn -L hostname - Substitute the actual hostname for the computer for hostname(to see the hostname, type hostname as a command prompt).

How to register a service principal name? ›

The SPN is registered using the Microsoft Windows Setspn command-line tool. To successfully register the SPN, you must have domain administrative privileges on the server or be logged in under a user account with those privileges delegated to it. Note: Setspn is a Microsoft tool.

How to set spn for sql service account? ›

Open a command prompt on a server that has the Windows Support Tools installed, and execute the following commands:
  1. setspn -A MSSQLSvc/MachineName:port domain\SQL Server Account.
  2. setspn -A MSSQLSvc/MachineName. FQDN:port domain\SQL Server Account.

What is the service principal name in SQL Server? ›

SPNs are used by the authentication protocol to determine the account in which a SQL Server instance runs. If the instance account is known, Kerberos authentication can be used to provide mutual authentication by the client and server.

How to add service principal to SQL database? ›

Then, you need to assign a role to the application like mentioned in this section :
  1. Go to the SQL Server Resource: Search for and select your SQL Server resource in the Azure portal.
  2. Set Active Directory Admin: ...
  3. Add the Service Principal to the Database: ...
  4. Run the following SQL commands to create a user and assign roles:
May 11, 2024

How to change server name in SQL Server using query? ›

To rename instance we can use the following SP
  1. Check the old server name as follows. SELECT@@servername.
  2. Drop the server and add the new server name. SP_DROPSERVER <oldName> SP_ADDSERVER <newName>, local.
  3. Restart the instance.
  4. Check the server name again.
Jan 3, 2023

How do I know if SQL Server authentication is enabled? ›

How to check SQL Server Authentication Mode
  1. Start Microsoft SQL Server Management Studio.
  2. Right-click the server name and select "Properties."
  3. Select the Security page.
  4. Verify that Server authentication is set to SQL Server and Windows Authentication mode.
Jan 12, 2022

How do I authenticate SQL Server? ›

In SQL Server Management Studio (SSMS) Object Explorer, right-click the server, and then select Properties. On the Security page, under Server authentication, select the new server authentication mode, and then select OK.

How do I know if Kerberos is working? ›

You can run the command nltest /dsgetdc:<Domain Name> /force /kdc (for example, nltest /dsgetdc:contoso.com /force /kdc ) on the client or target server. Domain Name System (DNS) is configured properly and resolves host names and services appropriately. The clocks are synchronized across the domain.

How to find service principal name? ›

How to Check SPNs. Use the setspn -l hostname command at a command prompt to display a list of the SPNs that a computer has registered with Active Directory, where hostname is the actual hostname of the computer object you want to query.

How do I check if my SPN is valid? ›

Verify SPN has been successfully registered Using SETSPN Command Line Utility. In Command Line enter the following command: setspn -L <Domain\SQL Service Account Name> and press enter. Next, you need to look for registered ServicePrincipalName to ensure that a valid SPN has been created for the SQL Server.

What is a ServicePrincipalName? ›

A service principal name (SPN) is a unique identifier of a service instance. Kerberos authentication uses SPNs to associate a service instance with a service sign-in account. Doing so allows a client application to request service authentication for an account even if the client doesn't have the account name.

How to resolve primary key violation error in SQL Server? ›

How to test this?
  1. Duplicate the Selection you are working on - then start working on the copied Selection.
  2. Create an In Filter and include only the Primary Keys indicated on the error message.
  3. Create an identical Target Data Extension without any Primary Key.
  4. Use the Sort & Limit feature to order by the Primary Key field.
Jun 8, 2022

How to remove spn in SQL Server? ›

To remove an SPN, use the setspn -d service/name hostname command at a command prompt, where service/name is the SPN that is to be removed and hostname is the actual host name of the computer object that you want to update.

What is spn for SQL Server? ›

A Service Principal Name (SPN) must be registered with Active Directory, which assumes the role of the Key Distribution Center in a Windows domain. The SPN, after it's registered, maps to the Windows account that started the SQL Server instance service.

How do I reset my Active Directory SPN? ›

The setspn tool is the built-in tool used to read, modify, and delete service principal names in Active Directory. It provides many options that allow admins to view, reset, add, or delete SPNs in AD DS. You can run setspn -? or simply setspn from an elevated command prompt to see the available options.

Top Articles
Google Maps Timeline - Computer
A look back at 15 years of mapping the world
Hometown Pizza Sheridan Menu
Why Are Fuel Leaks A Problem Aceable
فیلم رهگیر دوبله فارسی بدون سانسور نماشا
Lexington Herald-Leader from Lexington, Kentucky
Lenscrafters Westchester Mall
Mr Tire Rockland Maine
Was sind ACH-Routingnummern? | Stripe
Miami Valley Hospital Central Scheduling
Uhcs Patient Wallet
This Modern World Daily Kos
How to find cash from balance sheet?
Mary Kay Lipstick Conversion Chart PDF Form - FormsPal
Craigslist Farm And Garden Tallahassee Florida
24 Best Things To Do in Great Yarmouth Norfolk
Suffix With Pent Crossword Clue
The Menu Showtimes Near Regal Edwards Ontario Mountain Village
My Homework Lesson 11 Volume Of Composite Figures Answer Key
Jet Ski Rental Conneaut Lake Pa
/Www.usps.com/International/Passports.htm
1989 Chevy Caprice For Sale Craigslist
Lowes Undermount Kitchen Sinks
Red8 Data Entry Job
Best Middle Schools In Queens Ny
Rugged Gentleman Barber Shop Martinsburg Wv
Delta Township Bsa
Evil Dead Rise Ending Explained
Kaiserhrconnect
Craigslist Maryland Baltimore
MethStreams Live | BoxingStreams
Shaman's Path Puzzle
Gyeon Jahee
Morlan Chevrolet Sikeston
Etowah County Sheriff Dept
Arcadia Lesson Plan | Day 4: Crossword Puzzle | GradeSaver
The Boogeyman Showtimes Near Surf Cinemas
Raisya Crow on LinkedIn: Breckie Hill Shower Video viral Cucumber Leaks VIDEO Click to watch full…
The Minneapolis Journal from Minneapolis, Minnesota
Kerry Cassidy Portal
How to Get a Better Signal on Your iPhone or Android Smartphone
Flipper Zero Delivery Time
Guy Ritchie's The Covenant Showtimes Near Grand Theatres - Bismarck
Pathfinder Wrath Of The Righteous Tiefling Traitor
Why Are The French So Google Feud Answers
Ssc South Carolina
Spurs Basketball Reference
Frequently Asked Questions
Movie Hax
Lesly Center Tiraj Rapid
CPM Homework Help
Acellus Grading Scale
Latest Posts
Article information

Author: Tish Haag

Last Updated:

Views: 6464

Rating: 4.7 / 5 (67 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Tish Haag

Birthday: 1999-11-18

Address: 30256 Tara Expressway, Kutchburgh, VT 92892-0078

Phone: +4215847628708

Job: Internal Consulting Engineer

Hobby: Roller skating, Roller skating, Kayaking, Flying, Graffiti, Ghost hunting, scrapbook

Introduction: My name is Tish Haag, I am a excited, delightful, curious, beautiful, agreeable, enchanting, fancy person who loves writing and wants to share my knowledge and understanding with you.