I have a (Azure AD-group) that only shows up as a user

var userThatIsActuallyAGroup = myWeb.EnsureUser("MyAzureADGroupName");
var isGroup = (userThatIsActuallyAGroup.PrincipalType.ToString() =="Group")//"true"

So, How do I find/list the users in this group?


I would suggest you to use Graph API which has enough feature to satisfy your needs. Below Rest API endpoint helps you to get all the members of the AD group.


Please refer this.

| improve this answer | |

Graph API is the answer

Option 1 - Two REST Calls

  1. Get all groups using REST call - https://graph.windows.net/{tenant_id}/groups
  2. Find the object id of the group in question (MyAzureADGroupName)
  3. Once you have the object id - fire another call to extract the members - https://graph.windows.net/myorganization/groups/{object_id}/$links/members?api-version

Option 2 - Single Call

  1. If you know the object id of group then you can have a single call to this endpoint https://graph.windows.net/contoso.com/groups/{object_id}?$expand=members

More on this you can read here - https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/groups-operations

| improve this answer | |
  • Thanks for your answer! Ill appove it as soon as I have time to test/verify it. – Cowborg Oct 24 '17 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.