最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

azure active directory - Find User Entity in Entra ID from AzureAD account name - Stack Overflow

programmeradmin3浏览0评论

I'm working on a desktop application which accesses EntraID via the c# Graph API SDK.

The application monitors users logged into the device. Logged in user accounts are received as 'AzureAD\UserName'.

So for a logged in user account, 'AzureAD\JohnSmith' What I want to do is find the corresponding User entity 'John Smith' in Entra ID.

I guess what is needed is an Entra user attribute/property which holds the AzureAD account name 'Azuread\JohnSmith' and use this to query Entra via the Graph API.

I've searched the Entra Admin Centre, but cannot find an attribute which holds the AzureAD account name for any users in my test tenant.

Microsoft obviously do this mapping of AzureAD Account to Entra User entity internally, so I am hoping there is a way to do this.

I'd be grateful for any pointers or suggestions.

Thanks John

I'm working on a desktop application which accesses EntraID via the c# Graph API SDK.

The application monitors users logged into the device. Logged in user accounts are received as 'AzureAD\UserName'.

So for a logged in user account, 'AzureAD\JohnSmith' What I want to do is find the corresponding User entity 'John Smith' in Entra ID.

I guess what is needed is an Entra user attribute/property which holds the AzureAD account name 'Azuread\JohnSmith' and use this to query Entra via the Graph API.

I've searched the Entra Admin Centre, but cannot find an attribute which holds the AzureAD account name for any users in my test tenant.

Microsoft obviously do this mapping of AzureAD Account to Entra User entity internally, so I am hoping there is a way to do this.

I'd be grateful for any pointers or suggestions.

Thanks John

Share Improve this question asked Mar 21 at 12:59 JohnK88JohnK88 1 2
  • To map a local AzureAD\JohnSmith account to an Entra ID user, you can query Entra ID using the UserPrincipalName (UPN), typically in the format [email protected]. Use the Microsoft Graph API to find the user by UPN: var user = await graphClient.Users["[email protected]"].GetAsync(); If necessary, check the OnPremisesSamAccountName for on-premises sync scenarios. – Rukmini Commented Mar 24 at 7:31
  • Any update on the issue? – Rukmini Commented Mar 25 at 8:45
Add a comment  | 

1 Answer 1

Reset to default 0

Note: Using Microsoft Graph API, you cannot directly call AzureAD\JohnSmith

  • To map a local AzureAD\JohnSmith account to an Entra ID user, you can query Entra ID using the UserPrincipalName (UPN), in the format [email protected]. Use the Microsoft Graph API to find the user by UPN:

var result = await graphClient.Users["{user-id}"].GetAsync();

If necessary, check the OnPremisesSamAccountName for on-premises sync scenarios using Microsoft Graph API.

GET https://graph.microsoft/v1.0/users/[email protected]

Reference:

Get user - Microsoft Graph v1.0 | Microsoft Learn

发布评论

评论列表(0)

  1. 暂无评论