首页 > 解决方案 > Locating a user by alternate email address in Azure AD

问题描述

I currently use

(Get-MsolUser -UserPrincipalName $EmailAddress).ObjectID.Guid

to lookup a user by their PrincipalName in Azure AD and return their guid. However, there are times when a user has changed email addresses due to a name change and the address I have been given is not their PrincipalName but a secondary email address.

Is there a way to locate a user based upon an alternate email address? Perhaps a fuzzy search?

标签: azure-active-directoryazure-powershell

解决方案


根据租户中“用户”帐户的数量,返回每个用户帐户可能需要一些时间。请参阅以下内容:

Get-MsolUser -all | Where{$_.ProxyAddresses -like "smtp:<EMAIL ADDRESS>"}
(Get-MsolUser -all | Where{$_.ProxyAddresses -like "smtp:<EMAIL ADDRESS>"}).ObjectId.Guid

推荐阅读