Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get the groupId from group name in AAD graph API

it is possible to get the groupId from the group name using graph api, i am trying to validate if a user is part of a security group in azure active directory, but only know the group name at a time,

i think https://graph.windows.net/mytenantdomain/isMemberOf only supports groupId

like image 622
Oscar Cabrero Avatar asked May 21 '15 22:05

Oscar Cabrero


1 Answers

thanks for your question! You can query /groups with a filter expression to get the Group object for your group and then grab the objectId property to use for the isMemberOf function from that. For example:

https://graph.windows.net/myorganization/groups?api-version=1.5&$filter=displayName%20eq%20'Example%20Group'

You can learn more about the filterable properties for groups here: https://msdn.microsoft.com/en-us/Library/Azure/Ad/Graph/api/entity-and-complex-type-reference#GroupEntity

Hope that helps - Jimaco

like image 61
Jimaco Brannian Avatar answered Sep 20 '22 17:09

Jimaco Brannian