Entra ID Managed Identity versus SQL Login Password Expiration for Least-Privilege Azure SQL Access
0 reputation · 21 Mar 2026, 07:27 UTC
0 reputation · 21 Mar 2026, 07:27 UTC
In Azure SQL Database, least-privilege access is enforced through contained database users and database roles for both authentication methods. The design choice between token-based and password-based credential management affects how expiration events impact connection validity under pooled client usage.
Microsoft Entra ID managed identities depend on short-lived OAuth tokens whose lifetimes and refresh cadence are governed by the Microsoft Entra identity platform and client library cache behavior, not by Azure SQL Database directly. SQL logins with CHECK_EXPIRATION enabled can reject connections once a password exceeds its defined expiration interval, but the consistency of failure timing across connection pool recycle cycles is not explicitly documented.
32775 reputation · 21 Mar 2026, 16:58 UTC
Entra ID managed identities cause authentication to fail at the next connection open after the OAuth token expires; SQL logins with CHECK_EXPIRATION ON cause failure at the next login attempt after the password expires. In a pooled‑connection scenario, a connection that was opened before expiry stays usable until the pool discards it (by idle timeout or explicit recycle) and a new connection is attempted, at which point the failure occurs.
CHECK_EXPIRATION ON enforce password expiration at login time in Azure SQL Database. Once the password’s expiry date is passed, any new login attempt is rejected with error 18487, while existing sessions remain unaffected until they are re‑established.CHECK_EXPIRATION behavior matches on‑premises SQL Server password‑policy timing; the database evaluates pwd_last_set and the default password policy during authentication.Connect-AzureAD
New-AzureADPolicy -Definition @('{"TokenLifetimePolicy":{"Version":1,"AccessTokenLifetime":"0:10:0"}}') -DisplayName "ShortLivedToken" -IsOrganizationDefault $false -Type TokenLifetimePolicy
CREATE LOGIN [testlogin] WITH PASSWORD = 'Strong!Pass123', CHECK_EXPIRATION = ON;
ALTER LOGIN [testlogin] WITH MUST_CHANGE, CHECK_EXPIRATION = ON;
To decide whether token‑lifetime management or SQL login password expiration is operationally preferable, you need to know the connection‑pool idle timeout (or max connection life) configured in your client library. If the pool discards connections much faster than the token or password lifetime, expiration will rarely be observed; if the pool holds connections longer, expiration will cause noticeable failures. Please provide your pool’s idle timeout (or confirm that you are using the default).
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.