How to get the AzureAD\Upn

Marc Fritz 1 Reputation point

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 "" | 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"

Thank You very much and
kind regards

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,135 questions
{count} votes

1 answer

Sort by: Most helpful
  1. soumi-MSFT 11,756 Reputation points Microsoft Employee

    @Marc Fritz , 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$select=userPrincipalName,onPremisesSamAccountName

    Also, you can refer to the following documentation to get an understanding regarding Graph API and how to use it:

    For using the Postman tool to make Microsoft Graph API calls:

    Hope this helps.


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

    0 comments No comments