Share via

Login failed for user '<token-identified principal>' (I have spent many hours exhausting options)

Jonathon Childs 0 Reputation points
2026-05-05T16:05:31.53+00:00

Multiple App Service managed identities receive valid Entra tokens that are rejected by Azure SQL with "Login failed for user '<token-identified principal>'" even though:

  • The DB user mapping exists with type EXTERNAL_USER
  • The user's SID exactly matches the MI's Object ID
  • The token's oid and sub claims match the SID
  • The token's tid matches the SQL server's Entra admin tenant

I have reproduced with sqlcmd/Invoke-Sqlcmd presenting the token directly.

Production database on the same server accepts MI tokens from the parent App Services with identical setup. Only test slot identities against CDS_Azure_Test fail.

Started ~March 27, 2026.

Azure SQL Database

Your answer

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