<PackageReference Include="Microsoft.Identity.Client" Version="4.83.4-preview1" />

Microsoft.Identity.Client.ManagedIdentity.V2.InterprocessLock

static class InterprocessLock
Executes paramref name="action"/ under a cross-process, per-alias mutex. We attempt 2 namespaces, in order: 1) Global\ — preferred so we dedupe across all sessions on the machine (e.g., service + user session). This can be denied by OS policy or missing SeCreateGlobalPrivilege in some contexts. 2) Local\ — fallback to still dedupe within the current session when Global\ is not permitted. Using both ensures we never throw (persistence is best-effort) while getting machine-wide dedupe when allowed and session-local dedupe otherwise. Notes: - The mutex name is derived from alias (= cacheKey) via SHA-256 hex (truncated) to avoid invalid characters / length issues. - On non-Windows runtimes the Global/Local prefixes are treated as part of the name; behavior remains correct but dedupe scope is platform-defined. - Abandoned mutexes are treated as acquired to avoid blocking after a crash.
public static string GetMutexNameForAlias(string alias, bool preferGlobal = true)

public static bool TryWithAliasLock(string alias, TimeSpan timeout, Action action, Action<string> logVerbose)