az_group: Group in Azure Active Directory

az_groupR Documentation

Group in Azure Active Directory


Class representing an AAD group.


An R6 object of class az_group, inheriting from az_object.


  • token: The token used to authenticate with the Graph host.

  • tenant: The Azure Active Directory tenant for this group.

  • type: always "group" for a group object.

  • properties: The group properties.


  • new(...): Initialize a new group object. Do not call this directly; see 'Initialization' below.

  • delete(confirm=TRUE): Delete a group. By default, ask for confirmation first.

  • update(...): Update the group information in Azure Active Directory.

  • do_operation(...): Carry out an arbitrary operation on the group.

  • sync_fields(): Synchronise the R object with the app data in Azure Active Directory.

  • list_members(type=c("user", "group", "application", "servicePrincipal"), filter=NULL, n=Inf): Return a list of all members of this group. Specify the type argument to limit the result to specific object type(s).

  • list_owners(type=c("user", "group", "application", "servicePrincipal"), filter=NULL, n=Inf): Return a list of all owners of this group. Specify the type argument to limit the result to specific object type(s).


Creating new objects of this class should be done via the create_group and get_group methods of the ms_graph and az_app classes. Calling the new() method for this class only constructs the R object; it does not call the Microsoft Graph API to create the actual group.

List methods

All list_* methods have filter and n arguments to limit the number of results. The former should be an OData expression as a string to filter the result set on. The latter should be a number setting the maximum number of (filtered) results to return. The default values are filter=NULL and n=Inf. If n=NULL, the ms_graph_pager iterator object is returned instead to allow manual iteration over the results.

Support in the underlying Graph API for OData queries is patchy. Not all endpoints that return lists of objects support filtering, and if they do, they may not allow all of the defined operators. If your filtering expression results in an error, you can carry out the operation without filtering and then filter the results on the client side.

See Also

ms_graph, az_app, az_user, az_object

Microsoft Graph overview, REST API reference


## Not run: 

gr <- get_graph_login()
usr <- gr$get_user("")

grps <- usr$list_group_memberships()
grp <- gr$get_group(grps[1])


# capping the number of results

# get the pager object for a listing method
pager <- grp$list_members(n=NULL)

## End(Not run)

AzureGraph documentation built on March 18, 2022, 8:04 p.m.