unified groups

Glenn Maxwell 6,911 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")

Azure Active Directory
Azure Active Directory
An Azure enterprise identity service that provides single sign-on and multi-factor authentication.
13,648 questions
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
3,148 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
6,326 questions
Microsoft Exchange Hybrid Management
Microsoft Exchange Hybrid Management
Microsoft Exchange: Microsoft messaging and collaboration software.Hybrid Management: Organizing, handling, directing or controlling hybrid deployments.
1,309 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Jame Xu-MSFT 3,726 Reputation points Microsoft Vendor
    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.