# add ad groups in bulk

**URL:** <https://community.dynatrace.com/t/add-ad-groups-in-bulk/37091>\
**Category:** Open Q&A\
**Tags:** user-management, data-privacy-and-product-security, sso\
**Created:** [November 1, 2022, 1:49pm UTC](https://community.dynatrace.com/t/add-ad-groups-in-bulk/37091 "2022-11-01T13:49:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jordan\_rose](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@jordan\_rose](https://community.dynatrace.com/u/jordan_rose)\
**Post date:** [November 1, 2022, 1:49pm UTC](https://community.dynatrace.com/t/add-ad-groups-in-bulk/37091/1 "2022-11-01T13:49:34Z")

</div>

Hi All, looking for some help on how to add several groups for authentication.

I see the cluster v1 api endpoint that seems to allow to post groups in bulk, but I cannot find any documentation on this. Cluster API v1 \> User Groups \> /groups/bulk (post). This gives a sample payload but it is not very helpful.&nbsp;Is there doc on this so I can learn how to form the payload? Do I add the groups and assign permissions in the same call? Has any one else used this?

Thanks,

Jordan

---

<div class="post-metadata">

**Author:** ![dannemca](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/dannemca/32/7215_2.png) [@dannemca](https://community.dynatrace.com/u/dannemca)\
**Post date:** [November 1, 2022, 8:56pm UTC](https://community.dynatrace.com/t/add-ad-groups-in-bulk/37091/2 "2022-11-01T20:56:54Z")

</div>

Hi [@jordan\_rose](https://community.dynatrace.com/user/26207) , good day.

did you check for this doc already? [Dynatrace Account Management API](https://api.dynatrace.com/spec/#/Group%20management/GroupsController_createGroups)

You can GET a current group that has the permissions you need to get its id, then use a new GET to the group permissions using this id, and use its response as model in your POST request.

example:

```markup
curl --location --request GET 'https://api.dynatrace.com/iam/v1/accounts/your-tenant-id/groups' \
--header 'Authorization: Bearer yourtoken' \
--header 'Content-Type: application/json'

```

result is:

```markup
{
    "count": 2290,
    "items": [
        {
            "uuid": "95ce21f2-ec05-4470-9c2e-23b5b446fda7",
            "name": "Account viewer",
            "owner": "SAML",
            "description": null,
            "federatedAttributeValues": [
                "cn=CIO_Dyna_AccView"
            ],
            "hidden": false,
            "createdAt": "2019-09-26T17:42:47Z",
            "updatedAt": "2021-09-21T11:36:00Z"
        },
        {
            "uuid": "81d47053-bcf9-48b4-a831-f9f188e7a62c",
            "name": "Monitoring admin",
            "owner": "SAML",
            "description": null,
            "federatedAttributeValues": [
                "cn=CIO_Dyna_MonAdmin"
            ],
            "hidden": false,
            "createdAt": "2019-09-26T17:42:47Z",
            "updatedAt": "2021-09-21T11:37:46Z"
        },
...
}

```

using the group id to get the permissions:

```markup
curl --location --request GET 'https://api.dynatrace.com/iam/v1/accounts/your-tenant-id/groups/95ce21f2-ec05-4470-9c2e-23b5b446fda7/permissions' \
--header 'Authorization: Bearer yourtoken' \
--header 'Content-Type: application/json'

```

result is:

```markup
{
    "uuid": "95ce21f2-ec05-4470-9c2e-23b5b446fda7",
    "name": "Account viewer",
    "owner": "SAML",
    "description": null,
    "federatedAttributeValues": [
        "cn=CIO_Dyna_AccView"
    ],
    "hidden": false,
    "createdAt": "2019-09-26T17:42:47Z",
    "updatedAt": "2021-09-21T11:36:00Z",
    "permissions": [
        {
            "permissionName": "account-viewer",
            "scope": "your-tenant-id",
            "scopeType": "account",
            "createdAt": "2022-04-04T18:48:26Z",
            "updatedAt": "2022-04-04T18:48:26Z"
        },
        {
            "permissionName": "tenant-viewer",
            "scope": "your-tenant",
            "scopeType": "tenant",
            "createdAt": "2022-04-04T18:48:26Z",
            "updatedAt": "2022-04-04T18:48:26Z"
        },
        {
            "permissionName": "tenant-replay-sessions-with-masking",
            "scope": "your-tenant",
            "scopeType": "tenant",
            "createdAt": "2022-04-04T18:48:26Z",
            "updatedAt": "2022-04-04T18:48:26Z"
        }
    ]
}

```

then you can use it as model to create a new group and set its permission

Let me know if that helps.

---

<div class="post-metadata">

**Author:** ![jordan\_rose](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@jordan\_rose](https://community.dynatrace.com/u/jordan_rose)\
**Post date:** [November 2, 2022, 1:31pm UTC](https://community.dynatrace.com/t/add-ad-groups-in-bulk/37091/3 "2022-11-02T13:31:02Z")

</div>

This helped me figure it out.

Thanks for the reply!
