# Dynamic Group

{% hint style="info" %}
Dynamic group membership updates are expected to process for all groups within 24 hours. [Learn more](https://docs.microsoft.com/azure/active-directory/enterprise-users/groups-create-rule?WT.mc_id=Portal-Microsoft_AAD_IAM#check-processing-status-for-a-rule)
{% endhint %}

Rules for the Dynamic Group

```
(user.country -in ["MY","SG","VN","CN","TW","HK","IN","ID"]) and 
(user.displayName -in ["Snow Wang","Wenjian Khor"]) and 
(user.accountEnabled -eq True) and (user.mail -contains "jabil.com")
```

This will create a group with admin and requestor for the next step, which is disabling the Welcome email since the scope is huge for this group, and we don't want to spam everyone's inbox

Get the current setting for the group with the ExchangePowershell module

```powershell
Install-Module ExchangePowershell
Import-Module ExchangePowershell

Connect-ExchangeOnline

#Get current setting and update
Get-UnifiedGroup -Identity "GroupEmail@domain.com" | Select WelcomeMessageEnabled
Set-UnifiedGroup -Identity "GroupEmail@domain.com" -UnifiedGroupWelcomeMessageEnable:$false

#Check and compare with previous output
Get-UnifiedGroup -Identity "GroupEmail@domain.com" | Select WelcomeMessageEnabled
```

Now replace the `user.displayName -in ["Snow Wang","Wenjian Khor"])` with `user.displayName -NotIn ["People to exclude from the group"])`

By default, all emails to this "Group Address" will end up in the Group inbox. We need to adjust the setting below to get the email forwarded to the group users.

<figure><img src="/files/K0OlvekLFhDJkh9ewbfq" alt=""><figcaption></figcaption></figure>

If required, control who can send email to this DL via this setting on Exchange Admin

<figure><img src="/files/kbrPH0Z0TWmdAQpYgY5S" alt=""><figcaption></figcaption></figure>

The below error will show if you do not have permission to send email to this group

<figure><img src="/files/MfqsL0sHKVL0VM04SLO0" alt=""><figcaption></figcaption></figure>


---

# 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.jianny.net/work/azure/dynamic-group.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.
