How to get the AzureAD\Upn

Marc Fritz 1 Reputation point
2020-01-17T00:44:44.207+00:00

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://learn.microsoft.com/en-us/azure/active-directory/devices/assign-local-admin

Thank You very much and
kind regards
Marc

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
    2020-01-17T05:20:47.763+00:00

    @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 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://learn.microsoft.com/en-us/graph/use-the-api

    For using the Postman tool to make Microsoft Graph API calls: https://learn.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!

    0 comments No comments