SQL Server connection user varies when using '127.0.0.1' vs 'localhost'. Why?

  • When I attempt to connect to my local, default SQL Server instance via SQL Management studio using Windows Authentication, I successfully connect when I use Server Name "localhost", but fail when I use Server Name "127.0.0.1". With login auditing enabled for both failed and successful logins, I see that the successful logins are recorded as:

    Login succeeded for user 'AzureAD\RealUsername'. Connection made using Integrated Authentication. [CLIENT: <local machine>]

    And the failed logins are recorded as:

    Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. Reason: Could not find a login matching the name provided. [CLIENT: 127.0.0.1]

    Possibly relevant:

    • I can connect using the ip address if I use SQL Server authentication (since I am forcing it to use an existing login).
    • There is no entry in my hosts file for "localhost", and when I ping localhost it does resolve to 127.0.0.1.
    • The SQL instance uses port 1433.
    • The issue, with very little variation, persists when connecting via SQL Management Studio, a .NET web app running in a local IIS instance, or via UDL file on my desktop.


    Here is my question:
     Why would changing only the server value ('localhost' vs '127.0.0.1') change the identity used when connecting?

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply