Login failed for user '<token-identified principal>'.

Diego Cedeño 0 Reputation points
2024-12-16T02:36:55.21+00:00

Hello,

I am encountering the following error when trying to connect via Microsoft Entra Service Principal in SSMS. I

-As Username I am using the Application ID. (I tried with dieguitico0007_hotmail.com#EXT#@dieguitico0007hotmail.onmicrosoft.com but it says it is not registered in the default directory. Which is weird since it is.)

-As a password I am using the secret Value

I am getting this

TITLE: Connect to Server


Cannot connect to managementcasesdb.database.windows.net.


ADDITIONAL INFORMATION:

Login failed for user '<token-identified principal>'. (Microsoft SQL Server, Error: 18456)

For help, click: https://docs.microsoft.com/sql/relational-databases/errors-events/mssqlserver-18456-database-engine-error


BUTTONS:

OK


Instead, If I try this

https://login.microsoftonline.com/common/adminconsent?client_id=your_client_id

I am getting this from the browser

Sorry, but we’re having trouble signing you in.

AADSTS500113: No reply address is registered for the application.

Troubleshooting details

If you contact your administrator, send this info to them.

Copy info to clipboard

Request Id: 24231f08-68b4-4190-8c2a-99b8b88f1e00

Correlation Id: 6b987fb2-48cb-4c0a-b885-402746d89eb8

Timestamp: 2024-12-16T02:29:19Z

Message: AADSTS500113: No reply address is registered for the application.

Flag sign-in errors for review: Disable flagging

If you plan on getting help for this problem, enable flagging and try to reproduce the error within 20 minutes. Flagged events make diagnostics available and are raised to admin attention.

Any help would be appreciated.

Thank you,

Diego Cedeno

Azure SQL Database
Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

1 answer

Sort by: Most helpful
  1. Vijayalaxmi Kattimani 3,410 Reputation points Microsoft External Staff Moderator
    2024-12-18T10:12:16.16+00:00

    Hi @Diego Cedeño,

    Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

    The error "Login failed for user '' (Microsoft SQL Server, Error: 18456)" when attempting to use a Microsoft Entra Service Principal in SQL Server Management Studio (SSMS) typically indicates a misconfiguration in the Microsoft Entra or SQL Server authentication setup.

    To resolve this, you need to add an AAD user to the Azure SQL Database. you may also need to change the default database option. By default, SSMS attempts to connect to the Master database, where this AAD user may not exist since AAD users are contained within individual user databases.

    Below are links to some parallel threads that may assist you in troubleshooting your issue.

    https://learn.microsoft.com/en-us/answers/questions/133709/login-failed-for-user

    https://learn.microsoft.com/en-us/answers/questions/1281113/login-failed-for-user-(token-identified-principal)

    https://learn.microsoft.com/en-us/answers/questions/1001824/login-failed-for-user-(token-identified-principal)

    https://stackoverflow.com/questions/71494736/login-failed-for-user-token-identified-principal/77161216#77161216

    Please refer to the below mentioned links for more information.

    https://techcommunity.microsoft.com/blog/azuresqlblog/troubleshooting-problems-related-to-azure-ad-authentication-with-azure-sql-db-an/1062991

    https://learn.microsoft.com/en-us/azure/azure-sql/database/authentication-aad-configure?view=azuresql&tabs=azure-powershell#create-contained-database-users-in-your-database-mapped-to-azure-ad-identities

    I hope, This response will address your query and helped you to overcome on your challenges.

    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.