SQL Managed Instance: disabling an unused SQL login breaks Windows Authentication for Microsoft Entra principals instance-wide

Shaun Quarles 0 Reputation points
2026-10-28T21:06:05.5033333+00:00

Environment

  • Azure SQL Managed Instance using Windows Authentication for Microsoft Entra principals (incoming trust-based flow). Working reliably since late September 2026.
  • Applications connect with Integrated Security=SSPI as hybrid service accounts synced from on-premises AD to Entra ID, running as IIS application pool identities.
  • Client VMs are hybrid Microsoft Entra joined (DomainJoined: YES, AzureAdJoined: YES).
  • Client libraries: .NET SqlClient, EF Core 10.0.x, and EntityFramework 6.

Problem

New Entra Kerberos sign-ins intermittently fail on the instance, for every Entra login and from all client VMs, with:

Error 18456: Login failed for user ‘[service account]’. Reason: There was an internal error while attempting Windows Authentication for Azure AD Principals.

Existing pooled connections keep working; only new connections fail.

We can reproduce this on demand. Disabling a specific legacy SQL authentication login (ALTER LOGIN [LegacyLogin] DISABLE), or changing its password, immediately causes instance-wide Entra authentication failures. Re-enabling it, or restoring the old password, clears them within minutes. Doing the same to a different SQL login has no effect.

We also see the same error with no change to that login. These are daily isolated failures, often clustered just after the top of the hour (:00–:03), plus one burst of 149 failures over about three minutes across three service accounts and four client VMs.

What we’ve ruled out

  • No client uses the login. An Extended Events session capturing successful logins for it, validated by a test connection from SSMS, recorded zero application logins before and during a controlled disable test. No failed sign-ins as that login appear in the error log during any incident.
  • No connection strings reference it. No application connection strings reference it or use SQL authentication.
  • No server-level role or ownership. It is not the instance admin login, holds no server roles, and owns no databases, schemas, endpoints, SQL Agent jobs, or credentials.
  • Nothing executes as it. No code executes as it, no linked server uses it, and there is no logon trigger.
  • Database users aren’t the cause. Removing its database users caused no problem. Only disabling the login or changing its password reproduces the failure.

Questions

  1. What in Windows Authentication for Microsoft Entra principals on SQL MI could depend on a specific SQL authentication login, and how can it be safely disabled or removed?
  2. What else can cause the “internal error while attempting Windows Authentication for Azure AD Principals” failure?
  3. Could isolated failures that happen while the login is enabled and unchanged point to a configuration issue with Entra Kerberos or the incoming trust?
  4. Does anything in the Entra Kerberos authentication flow run on an hourly cadence that could explain failures clustered just after the top of the hour?
  5. What client-side resilience is recommended while this is investigated?
Azure SQL Database

3 answers

Sort by: Most helpful
  1. Deepesh Dhake 1,325 Reputation points
    2026-10-29T22:27:42.9133333+00:00
    1. Dependency on the login: Nothing documented. In the documented flow, the instance exchanges the Kerberos ticket with Entra ID for a token, and no SQL login is involved. Your repro suggests an undocumented dependency: something needs that login enabled with that exact password. It could be connecting as the login or only checking its state. Keep it enabled with the working password and open a Microsoft support case. Don't disable it until Microsoft identifies the dependency.
    2. Other causes: Failures or throttling in the Entra token exchange, problems with the instance's service principal, Conditional Access blocking that principal, proxy throttling under high Windows-auth connection volume, or platform events.
    3. Trust issue? Probably not, since every client and account fails at once. To confirm, run klist get MSSQLSvc/<miname>.<dnszone>.database.windows.net:1433 during a failure. If it returns a valid ticket from kerberos.microsoftonline.com, the trust worked and the failure is on the instance side.

    Was this answer helpful?

    0 comments No comments

  2. AI answer

    2026-10-29T13:13:18.3+00:00

    The documented Kerberos-to-Microsoft Entra authentication flow contains no dependency on a SQL-authenticated login or its password, so keep LegacyLogin enabled with its known working password and open an Azure SQL Managed Instance support case before disabling, changing, or dropping it again.

    In this flow, the client submits a Kerberos ticket to SQL Managed Instance, which exchanges it with Microsoft Entra ID for a token; an unrelated SQL login is not a documented input ^1^. Your controlled reproduction—combined with the dependency checks already completed—is therefore an undocumented coupling, not a supported SQL-login dependency with a documented self-service removal procedure.

    Escalate the reproducible login coupling

    Do not drop and recreate the login as a diagnostic step. Give Microsoft Support:

    • MI resource name and region, affected database names, and precise UTC test windows.
    • The exact ALTER LOGIN operation and the times at which failures begin and recover.
    • SQL error-log rows including the 18456 state. States 102–111 and 132–133 identify Entra failures; an unlisted state can indicate unexpected internal processing ^2^.
    • Extended Events capturing error_reported for 18456, login, client_hostname, client_app_name, and connection identifiers during one controlled test. Creating an XE session requires ALTER ANY EVENT SESSION ^3^.
    • Evidence that the affected principal is not AzureSQLConnectivityChecker. MI’s automatic connectivity test intentionally generates 18456 approximately every ten seconds under that login; it does not explain failures naming your service accounts ^4^.

    Investigate the independent intermittent failures

    The failures occurring while LegacyLogin is unchanged could have a separate Kerberos/incoming-trust cause.

    1. Capture tickets in the failing IIS worker identity’s security context. Tickets from an administrator’s interactive session do not establish what the application-pool identity has cached. During an incident, have the Windows/IIS administrator capture equivalent klist results from the worker-process identity context:
         klist get krbtgt/kerberos.microsoftonline.com
         klist get MSSQLSvc/<mi-name>.<dns-zone>.database.windows.net:1433
         klist
      
      The SQL service ticket should be from the kerberos.microsoftonline.com realm ^5^.
    2. Branch on the returned Kerberos error:
      • 0x6fb: validate the SQL SPN and incoming-trust Trusted Domain Object.
      • 0x52f: review Conditional Access affecting the application named <instance-name> principal. Microsoft documents excluding that MI service principal as mitigation ^5^. This weakens a security control: only use a narrowly scoped exclusion after Conditional Access/security-owner review, document the exception, and test it before broader deployment.
      • 0x51f: on the affected client, run:
             netsh winhttp reset autoproxy
             netsh winhttp reset proxy
        
        Then remove only ProxyMgr registry subentries configured with port :8888, restart the client, and retest. Registry changes are risky; export the key first and have the Windows administrator perform the change ^5^.
    3. Validate the incoming trust and GPO using domain/enterprise and Hybrid Identity administrator credentials. Get-AzureADKerberosServer should show CloudTrustDisplay as Microsoft.AzureAD.Kdc.Service.TrustDisplay. If the KDC proxy policy is absent or incorrect, enable: Administrative Templates → System → Kerberos → Specify KDC proxy servers for Kerberos clients Add this mapping, preserving the documented spaces:
      • Name: KERBEROS.MICROSOFTONLINE.COM
      • Value: <https login.microsoftonline.com:443:<tenant-id>/kerberos />
      ^6^
    4. Validate MI identity configuration with an Entra administrator: Azure portal → SQL managed instance → Identity must have its system-assigned service principal enabled, and <instance-name> principal must have admin consent ^7^.

    No supplied Microsoft documentation identifies an hourly authentication task that would explain :00–:03. Treat that timing as correlation evidence, not an established cadence. Include it in the support case and correlate it with ticket results, Conditional Access logs, domain-controller events, and exact UTC timestamps. Kerberos key rotation is a separate documented operation whose changes can take several hours to propagate—not an hourly process ^6^.

    Client-side containment

    • Microsoft documents setting pooled connection lifetime to less than five minutes for this feature, preventing reuse after security-cache invalidation ^5^. The cited MI guidance does not specify the provider-specific connection-string keyword or units; confirm those against the exact Microsoft.Data.SqlClient or System.Data.SqlClient version before deployment rather than assuming the syntax is identical.
    • For EF Core, enable bounded execution-strategy retries:
        options.UseSqlServer(connectionString, sql =>
            sql.EnableRetryOnFailure(
                maxRetryCount: 3,
                maxRetryDelay: TimeSpan.FromSeconds(15),
                errorNumbersToAdd: null));
      
      This does not establish that every 18456 is retryable. Add authentication errors only after identifying a narrowly scoped transient signature; generic 18456 retries can mask permanent configuration or credential failures ^8^.
    • EF6 can enable SqlAzureExecutionStrategy, but its documented built-in transient list does not include 18456:
        public sealed class EfConfiguration : DbConfiguration
        {
            public EfConfiguration() =>
                SetExecutionStrategy(
                    "System.Data.SqlClient",
                    () => new SqlAzureExecutionStrategy(3, TimeSpan.FromSeconds(15)));
        }
      
      ^9^

    Use bounded backoff with jitter, log every retry, and retry an entire transaction rather than an individual statement within it ^10^.


    References

    1. How Windows Authentication for Azure SQL Managed Instance is implemented with Microsoft Entra ID and Kerberos
    2. MSSQLSERVER_18456
    3. Run a trace against Azure SQL Managed Instance using Windows Authentication for Microsoft Entra principals
    4. Automatic internal connectivity tests for Azure SQL Managed Instance
    5. Troubleshoot Windows Authentication for Microsoft Entra principals on ...
    6. How to set up Windows Authentication for Microsoft Entra ID with the ...
    7. Configure Azure SQL Managed Instance for Windows Authentication for Microsoft Entra ID
    8. Implement resilient Entity Framework Core SQL connections
    9. SqlAzureExecutionStrategy Class-Definition
    10. Configurable retry logic in SqlClient
    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

  3. Erland Sommarskog 138.6K Reputation points MVP Volunteer Moderator
    2026-10-28T21:42:24.6633333+00:00

    Have you checked the SQL Server errorlog more messages related to this login failure? Maybe there is a clue.

    I can think of a possible reason, but it is very far-fetched. That is, you could have a logon trigger that makes a call on loopback linked server setup with login-mapping using this login. But that would be really crazy. A start, though, is to check if you have any logon trigger at all.

    Was this answer helpful?

    0 comments No comments

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.