dynamic membership rule

Rising Flight 3,161 Reputation points

Hi All

We are using exchange 2016 hybrid environment, we create users in onprem and migrate to online. In Azure AD I can see Office location for the users i.e it is synced from onprem to azure AD.

I want to create dynamic unified group for one office location lets say office location is abc. In abc location, some users have office location as abc and for some users office location is remote, abc. I want pull users with office location abc and abc, remote. In Azure AD for the unified group, under dynamic membership rules i want to try the below queries but i am not sure, please guide me.

(user.Office location -eq "*abc*") -or (user.Office location -eq "*abc*" and "*remote*" )

(user.Office location -contains "*abc*") -or (user.Office location -eq "*abc*" and "*remote*" )

I am only looking for key words abc ,remote, after abc or before abc, after remote or before remote it can be anything.

Microsoft Exchange Online
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,889 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.
7,025 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,183 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
17,587 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Rich Matheisen 43,076 Reputation points

    I don't see "officelocation" or "office" in the list of acceptable property names here: https://learn.microsoft.com/en-us/entra/identity/users/groups-dynamic-membership

    0 comments No comments

  2. Yuki Sun-MSFT 37,366 Reputation points

    Hi @Rising Flight ,

    I want pull users with office location abc and abc, remote.

    Based on my test, office location field is corresponding to the property "physicalDeliveryOfficeName".
    User's image

    So, I‘d recommend using the syntax below instead:

    (user.physicalDeliveryOfficeName -eq "abc") -or (user.physicalDeliveryOfficeName -eq "Remote, abc") -or (user.physicalDeliveryOfficeName -eq "abc, Remote")

    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

  3. Sandeep G-MSFT 11,331 Reputation points Microsoft Employee

    @Rising Flight

    Thank you for posting this in Microsoft Q&A.

    As Rich Matheisen mentioned, there is no "officelocation" or "office" attributes which are shown for dynamic group rules.


    I have checked this in my lab and when we pull the user properties from Azure AD, I found that Office location attribute is set in Azure AD as user attribute "physicalDeliveryOfficeName".

    To filter users with office location you will have to use the "user.physicalDeliveryOfficeName -eq "value"" in your rule that you create.

    You can use the rule as below and this should work for you,

    (user.physicalDeliveryOfficeName -eq "abc") -or (user.physicalDeliveryOfficeName -eq "Remote, abc") -or (user.physicalDeliveryOfficeName -eq "abc, Remote")

    Let me know if you have any further questions.

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.