I needed to find a user based on their email address (to which they had received a license) and then connect that back to their primary identity for our internal billig.
In AD there are 2 fields that hold the emails:
email
proxyAddresses.*
How can I find the actual user’s identity based on any 1 of their email addresses
2
Answers
Finding a user by their primary email address is quite simple:
Finding a user based on an email alias is a bit harder. In our case these are all stored in the
proxyAddresses
field in their user profile and the values are prefixed withsmtp:
. To find them use:Microsoft.Graph
:Az
:If you want to go full vanilla and query the user API directly you will need an application with one of these Permissions then the code to request a token and query the API would be (notice variables that should be pre-populated:
$appid
,$secret
,$tenantId
,$email
):