Azure AD B2C User Flow migration: password hash handling and active sessions during cutover
0 reputation · 13 Jun 2024, 08:18 UTC
0 reputation · 13 Jun 2024, 08:18 UTC
I am planning to migrate a small application to a new Azure AD B2C User Flow without downtime. The documented approach of on-the-fly user import via the Microsoft Graph API, combined with a staged cutover using a new User Flow and gradual traffic redirection, looks workable in principle.
Two behaviors remain unclear to me before I commit to this design. First, password handling: the import path appears to require either preserving the existing password hash store or re-hashing credentials during migration, and the consequences of each option for users who sign in mid-migration are not clear. Second, session continuity: if the old User Flow is disabled too early, active sessions may be terminated, but I have found no defined guidance on how token renewal should be handled for users whose sessions span the cutover.
Assume a current B2C tenant and a low-traffic app where a brief test migration on a copy of the environment is feasible.
30275 reputation · 13 Jun 2024, 15:56 UTC
invalid_grant on refresh and logs users out immediately.passwordProfile with a clear‑text password when creating a user. The API does not accept pre‑computed hashes, so the old hash cannot be carried over.old-flow and new-flow.new-flow via Graph API, supplying a known clear‑text password for each.
POST https://graph.microsoft.com/v1.0/identityUserFlows/{new-flow-id}/users
{
"accountEnabled": true,
"displayName": "Test User",
"mailNickname": "testuser",
"userPrincipalName": "[contact removed]",
"passwordProfile": {
"password": "P@ssw0rd123",
"forceChangePasswordNextSignIn": false
}
}
old-flow.old-flow only after the waiting period.invalid_grant errors on refresh; if they appear before the expected window, adjust the wait time or review token policies.To fine‑tune the safe disable time, confirm the exact refresh‑token lifetime configured for your tenant. If it differs from the default 24 hours, adjust the waiting period accordingly.
Preserve user experience by keeping token lifetimes and signing keys identical across flows, import users with clear‑text passwords, and wait for the longest token lifetime before retiring the old flow.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.