Set the max number of groups to retrieve while creating an AD connection

Problem statement

I am creating an Azure AD Enterprise connection and want to know the parameter in the payload to set the max number of groups to retrieve while creating an AD connection.

Solution

This can be accomplished by including an “options.max_groups_to_retrieve” parameter when creating or updating an Azure AD connection with the Management API.

Here’s the sample payload to set max groups with the /api/v2/connections endpoint:

{
    "strategy": "waad",
    "options": {
        "use_wsfed": false,
        "useCommonEndpoint": false,
        "basic_profile": false,
        "ext_profile": false,
        "ext_groups": true,
        "ext_nested_groups": false,
        "api_enable_users": false,
        "waad_protocol": "openid-connect",
        "identity_api": "microsoft-identity-platform-v2.0",
        "should_trust_email_verified_connection": "never_set_emails_as_verified",
        "domain": "test.com",
        "tenant_domain": "test.com",
        "client_id": "123",
        "client_secret": "1234",
        "max_groups_to_retrieve": "189"
    },
    "name": "test"
}