I have users in my Azure AD, i need to get users from AD and put it in C# list with all their properties. Just like here (users -> all users in the organization): https://developer.microsoft.com/en-us/graph/graph-explorer#
I found some documentation but i dont understand how to use it properly. In general, result must be C# list, or maybe json file with users and their properties. Can you please give me an example or something?
Documentation:
https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/users-operations#GetUsers
https://learn.microsoft.com/en-us/powershell/module/azuread/get-azureaduser?view=azureadps-2.0
You can get the user information for the signed-in user by replacing /users/{id | userPrincipalName} with /me .
https://developer.microsoft.com/en-us/graph/graph-explorer is talking about Microsoft Graph API, while https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/users-operations#GetUsers is talking about Azure AD Graph API. For detailed comparison between them, you could follow Microsoft Graph or Azure AD Graph.
In general, Microsoft recommends you use Microsoft Graph over Azure AD Graph. I would recommend you use Microsoft Graph .NET Client Library to communicate with Microsoft Graph API.
In order to authenticate for the Microsoft Graph service, firstly you need to register your application to use the Microsoft Graph API. For Azure AD v2.0, use the app registration portal, while for Azure AD v1.0, use portal.azure.com.
For Azure AD v2.0, you could follow this code sample for detailed steps. Moreover, you could also leverage Microsoft Authentication Library (MSAL) for acquiring the access token for constructing your GraphServiceClient
.
For Azure AD v1.0, you need to register your app and grant the permissions for your app to access Microsoft Graph API as follows:
Then, you could leverage ADAL for authenticating. Moreover, for detailed Microsoft Graph user permissions, you could follow here. For Delegated permissions vs Application permissions, you could follow here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With