Forum Discussion
Reza-rahman
Dec 18, 2023Copper Contributor
Creating a "Managers" group in Azure
Hi
I asked my question in Microsoft community here but it still have a problem with that, I would like to create a Microsoft 365 group in Azure that contains every manager if:
- The user's email address contains "@test.com".
- The user's mailNickname does not contain a dot.
- The user's account is enabled.
- The user has one or more direct reports.
I created the below PowerShell command:
(user.mail -contains "@test.com") and (-not user.mailNickname -contains ".") and (user.accountEnabled -eq true) and (DirectReports -ne $null)
but it doesn't work and says: "Directreport' is not supported, what should I do?
- You cannot create such a group. The "Direct reports" query can only be used as specified here: https://learn.microsoft.com/en-us/entra/identity/users/groups-dynamic-membership#other-properties-and-common-rules
You can use an Exchange Dynamic Distribution group though. If it must be an Azure AD groups, you are limited to either assigned membership, or using a different rule, for example one based on extensionAttributeXX. Details are here: https://www.michev.info/blog/post/5559/create-an-all-managers-group-in-microsoft-365- Reza-rahmanCopper Contributor
VasilMichev thanks I tried the Dynamic distribution list as well based on this topic but it didn't work, can you please assist me in getting it done?
- There is a working example in the article above, use it.