User Identity is blank

JayPenney 0 Reputation points
2024-03-12T15:04:38.43+00:00

Install the Azure AD PowerShell module if it's not already installed

Install-Module -Name MSOnline

Connect to your Azure AD tenant

Connect-MsolService

Replace "user@example.com" with the email address of the user you want to find

$user = Get-MsolUser -UserPrincipalName "user@example.com"

Display the Identity field for the user

Write-Host "User Identity:" $user.Identity

and now at the end of that chain here is the copy/paste

PS C:\Windows\system32> Write-Host "User Identity:" $user.Identity

User Identity:

PS C:\Windows\system32>

User Identity is blank...

Hybrid environment, using global admin trying to find my User Identity.

In Entra admin, on the user page under overview - I see an "On-premises immutable ID" that looks good - but does not work

Exchange Online
Exchange Online
A Microsoft email and calendaring hosted service.
6,173 questions
Exchange | Hybrid management
Windows for business | Windows Server | User experience | PowerShell
Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

1 answer

Sort by: Most helpful
  1. Marcin Policht 49,790 Reputation points MVP Volunteer Moderator
    2024-03-12T17:29:48.84+00:00
    1. Make sure that the user@example.com is a valid Entra ID user account
    2. Stop using the MSOnline module (it's deprecated). Use MSGraph instead.
    # Connect to Microsoft Graph
    Connect-MgGraph
    # Get user by User Principal Name (UPN)
    $user = Get-MgUser -UserPrincipalName "user@example.com"
    
    

    This will retrieve the user object based on the specified UPN from Microsoft Graph. Make sure to have the Microsoft Graph PowerShell module installed (Install-Module -Name Microsoft.Graph). The Connect-MgGraph cmdlet is used to establish a connection to Microsoft Graph before executing other Graph-related cmdlets.


    hth

    Marcin

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.