Office365-如何在powershell中使用ImmutableId检索UPN?

Office365-如何在powershell中使用ImmutableId检索UPN?,powershell,office365,azure-powershell,Powershell,Office365,Azure Powershell,我有一个office 365用户的不可变ID。如何使用powershell检索相应用户的UPN?在powershell中,您可以使用对象标识符在Azure AD中查询用户 $msolcred = get-credential connect-msolservice -credential $msolcred get-msoluser -ObjectId "{guid:object_identifier}" 更新#1:按不可变ID查询用户 get-msoluser | Where-Object

我有一个office 365用户的不可变ID。如何使用powershell检索相应用户的UPN?

在powershell中,您可以使用对象标识符在Azure AD中查询用户

$msolcred = get-credential
connect-msolservice -credential $msolcred
get-msoluser -ObjectId "{guid:object_identifier}"

更新#1:按不可变ID查询用户

get-msoluser | Where-Object {$_.ImmutableId -eq "zYGi36Y8tkCwX4lYBb8bUA=="}

更新#1:

另一个替代选项是使用Microsoft Graph API,而不是使用PowerShell get-msoluser模块:

https://graph.microsoft.com/v1.0/users?$filter=onPremisesImmutableId+eq+'zYGi36Y8tkCwX4lYBb8bUA=='

谢谢你的回复。但是我只有o365用户的immutableid,而没有objectid。嗨,Jeffrey,是的,我最后只使用了上面的cmdlet。但我认为如果不处理o365中的所有用户,有没有一种直接的方法来检索具有immutableid的用户。由于上述cmdlet涉及扫描您知道的所有用户。@Praveen,因此对于新功能请求,您可以提交有关Azure Active Directory反馈的反馈: