【发布时间】:2016-08-30 19:48:28
【问题描述】:
我有一个 Office 365 用户的 immutableid。如何使用powershell检索对应用户的UPN?
【问题讨论】:
标签: powershell office365 azure-powershell
我有一个 Office 365 用户的 immutableid。如何使用powershell检索对应用户的UPN?
【问题讨论】:
标签: powershell office365 azure-powershell
在 Powershell 中,您可以使用对象标识符在 Azure AD 中查询用户。
$msolcred = get-credential
connect-msolservice -credential $msolcred
get-msoluser -ObjectId "{guid:object_identifier}"
UPDATE#1:通过 ImmutableId 查询用户
get-msoluser | Where-Object {$_.ImmutableId -eq "zYGi36Y8tkCwX4lYBb8bUA=="}
更新#1:
不使用 PowerShell get-msoluser 模块,另一种选择是使用 Microsoft Graph API:
https://graph.microsoft.com/v1.0/users?$filter=onPremisesImmutableId+eq+'zYGi36Y8tkCwX4lYBb8bUA=='
【讨论】: