question

MarcFritz-9144 avatar image
MarcFritz-9144 asked ·

How to get the AzureAD\Upn

Hello AzureAD-Team,

i try to find the Upn from a AAD-Only-User with the Azure Cloud Shell, trying the command:

Get-AzureADUser -ObjectId "my.user@somewhere.onmicrosoft.com" | fl

but there i can't find the Upn like this: AzureAD\myUser

Can you help me please to get the Upn from my AAD-Users so they can login on a AzureAD-Joined Windows10 Client?

net localgroup "Remote Desktop Users" /add "azuread\Upn"

https://docs.microsoft.com/en-us/azure/active-directory/devices/assign-local-admin

Thank You very much and
kind regards
Marc

azure-active-directory
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

soumi-MSFT avatar image
soumi-MSFT answered ·

@MarcFritz-9144, UPN (UserPrincipalName) and Domain/Username are not the same. In the domain/username format, the value in the username section comes from the attributeValue of SamAccountName that is available with On-Prem user objects.

Ideally with default AD Connect Sync rules, this attribute "SamAccountName" gets synced to Azure AD as "onPremisesSamAccountName". Inoder to find the onPremisesSamAccountName attribute value from cloud, you would have to use the GraphAPI calls, since this attribute is only exposed to Graph API.

You can use the following GraphAPI call https://graph.microsoft.com/beta/users?$select=userPrincipalName,onPremisesSamAccountName

Also, you can refer to the following documentation to get an understanding regarding Graph API and how to use it: https://docs.microsoft.com/en-us/graph/use-the-api

For using the Postman tool to make Microsoft Graph API calls: https://docs.microsoft.com/en-us/graph/use-postman



Hope this helps.


Please take a moment to "Mark as Answer" and/or "Vote as Helpful" wherever applicable. Thanks!

Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.