unified groups

Glenn Maxwell 13,121 Reputation points
2023-03-02T05:49:57.2333333+00:00

Hi All

i want to create a dynamic unified group in office365. i am using exchange 2016 hybrid environment. below attributes are synced to Azure AD(employee id, country)

we have Full time employees their employee ids starts with F for example F1,F2,F3 and we have temp employees whose employee ids starts with T1,T2,T3. i want to pull all these users from the country USA

In Azure AD, under groups, i have changed the group type to dynamic,  which of the below query will pull me the information. please correct me with the syntax.

(user.accountEnabled -eq true) -and (user.employeeId -notStartsWith "T") -and (user.country -eq "USA")

or

(user.accountEnabled -eq true) -and (user.employeeId -notStartsWith "T*") -and (user.country -eq "USA")

Exchange Online
Exchange Online
A cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.
Exchange | Exchange Server | Management
Exchange | Exchange Server | Management
The administration and maintenance of Microsoft Exchange Server to ensure secure, reliable, and efficient email and collaboration services across an organization.
Exchange | Hybrid management
Exchange | Hybrid management
The administration of a hybrid deployment that connects on-premises Exchange Server with Exchange Online, enabling seamless integration and centralized control.
Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

Answer accepted by question author
  1. Jame Xu-MSFT 4,191 Reputation points
    2023-03-03T06:04:05.28+00:00

    Hi @Glenn Maxwell ,

    To create a dynamic unified group in Office 365 based on the criteria you described, you can use the query below.

    This query will pull all users who are enabled, have an employee ID starting with "F" or "T", and are located in the USA.

    The notStartsWith operator is not supported in the query syntax for dynamic groups in Azure AD. Instead, you can use the like operator with a wildcard (*) to match users with an employee ID starting with either "F" or "T".

    (user.accountEnabled -eq true) -and ((user.employeeId -like "F*") -or (user.employeeId -like "T*")) -and (user.country -eq "USA")
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.