Azure AD Join: How to Uniquely Identify Users When Display Names Differ Only by Spaces?
hi,
When joining a Windows device to Azure AD, the Azure AD user account used for the join is automatically added to the local Administrators group. The display name shown in the group (e.g., AzureAD\TestUserAcc
) removes spaces from the original Azure AD display name (which may be, for example, Test User Acc
). Additionally, in the Windows Event Viewer, events related to this account also show the display name without spaces (e.g., AzureAD\TestUser
), even though the actual Azure AD display name contains spaces.
This creates ambiguity when there are multiple Azure AD users whose display names differ only by spaces (e.g., Test User Acc
vs. TestUser Acc
). It becomes difficult to differentiate between these users using only the display name in Event Viewer, especially since some events do not include the user's SID.
Questions:
- How can I reliably differentiate between Azure AD users in Windows event logs when their display names differ only by spaces?
- Is there a location on the Windows machine (such as a file, registry, or user profile property) where I can retrieve the Azure AD user's UPN, original display name (with spaces), domain name, and SID as mapped on that device?
- Is there any Windows API or PowerShell command that can retrieve the full Azure AD user details (UPN, display name, domain, SID) as stored locally on the device, or any official documentation regarding this mapping?
Any guidance or best practices on uniquely identifying Azure AD users in this scenario would be greatly appreciated.