# Creation of dynamic groups in Microsoft Entra ID

This guide covers the necessary steps to set up a **group with dynamic membership** in Microsoft Entra ID. This is particularly useful for the correct configuration of the [People Directory](https://docs.intranet.ai/sharepoint-intranet/configurations/people-directory), ensuring that it displays only employee contacts while excluding service accounts, admin contacts, and other users who should not be visible on the intranet.

Dynamic groups offer several benefits, the most important of which being **automated membership management**: dynamic groups automatically update their membership based on defined criteria, reducing the need for manual updates.

Please note that to create a dynamic group, an **admin account of Microsoft Entra** is needed.

{% hint style="info" %}
[Click here](https://learn.microsoft.com/en-us/entra/identity/users/groups-create-rule) to learn more about creating or updating a dynamic membership group in Microsoft Entra ID.
{% endhint %}

## Create a new group

To create a new group, take the following steps:&#x20;

* Go to the [**Microsoft Entra**](https://entra.microsoft.com/) portal.
* Select **Groups** in the left-hand navigation pane.
* Click on **All groups**.
* Choose **New group**.

<div align="left"><figure><img src="https://2718234637-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FriXlnuemuParrCf7Uotu%2Fuploads%2FUb1OIWczGisn31fMqn5u%2F1.png?alt=media&#x26;token=06a2c0f6-6c8b-4d94-9c4c-a2764e64e536" alt=""><figcaption></figcaption></figure></div>

* On the **Group** page, enter a name and a description for the new group.
* Select a **Membership type** for either users or devices.

***

## Create a dynamic query

* Select **Add dynamic query** to open the rule builder. The rule builder supports up to **five expressions**. To add more than five expressions, you must use the text box.
* In order to create a query that adds users according to a specific parameter (e.g. business email), use the text box and enter **-contains**.
* After creating the rule, select **Save**.
* Select **Create** to create the group.

***

## Create an associated Team

A Microsoft 365 group can be used to create a team in Microsoft Teams. The necessary steps are as follows:

* Go to the [admin exchange portal](https://admin.exchange.microsoft.com/).
* Click on **Groups** and select the newly created group.
* On the right-hand panel, click on **Microsoft Teams**.
* Select **Create a team**.

<div align="left"><figure><img src="https://2718234637-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FriXlnuemuParrCf7Uotu%2Fuploads%2F37sodpDkEm73t4e8UO6H%2F2.png?alt=media&#x26;token=09541cab-bb1d-434c-88b4-f1811cdc2bb5" alt=""><figcaption></figcaption></figure></div>

Now you have a Microsoft 365 group with a dynamic membership and an associated team. You can also use it for [Teams push notifications](https://docs.intranet.ai/sharepoint-intranet/other-configurations/teams-push-notifications) in production.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.intranet.ai/sharepoint-intranet/other-configurations/creation-of-dynamic-groups-in-microsoft-entra-id.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
