Hi @Zahmi Zuhair ,
Thanks for reaching out.
I understand you are trying to get the username registered in B2C using Graph API endpoint but user principal name getting to show random guid rather than actual username.
This is due to username is part of identities property of the user representing an identity used to sign in to a user account i.e email, username, federated or user principal name.
As you can see in portal as well, username is part of Identities and username is showing under Issuer Assigned Id.
Getting a user only retrieving the default set of properties only. To get the properties and relationships of user object, you need to use $select which will retrieve issuerAssignedId which represents username.
Reference : https://learn.microsoft.com/en-us/graph/api/resources/objectidentity?view=graph-rest-1.0
Hope this will help.
Thanks,
Shweta
Please remember to "Accept Answer" if answer helped you.