diff --git a/providers/ms365/resources/groups.go b/providers/ms365/resources/groups.go index c677280311..e93a251c27 100644 --- a/providers/ms365/resources/groups.go +++ b/providers/ms365/resources/groups.go @@ -8,6 +8,8 @@ import ( "errors" "github.com/microsoftgraph/msgraph-sdk-go/groups" + "github.com/microsoftgraph/msgraph-sdk-go/models" + "go.mondoo.com/cnquery/v10/llx" "go.mondoo.com/cnquery/v10/providers/ms365/connection" ) @@ -27,14 +29,22 @@ func (a *mqlMicrosoft) groups() ([]interface{}, error) { return nil, err } + top := int32(200) + queryParams := &groups.GroupsRequestBuilderGetQueryParameters{ + Top: &top, + } ctx := context.Background() - resp, err := graphClient.Groups().Get(ctx, &groups.GroupsRequestBuilderGetRequestConfiguration{}) + resp, err := graphClient.Groups().Get(ctx, &groups.GroupsRequestBuilderGetRequestConfiguration{ + QueryParameters: queryParams, + }) + if err != nil { + return nil, transformError(err) + } + grps, err := iterate[*models.Group](ctx, resp, graphClient.GetAdapter(), groups.CreateDeltaGetResponseFromDiscriminatorValue) if err != nil { return nil, transformError(err) } - res := []interface{}{} - grps := resp.GetValue() for _, grp := range grps { graphGrp, err := CreateResource(a.MqlRuntime, "microsoft.group", map[string]*llx.RawData{