dynamic membership rule

Rising Flight 4,796 Reputation points
2023-10-27T19:40:47.3666667+00:00

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.
4,686 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,755 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,601 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
22,877 questions
{count} votes

Accepted answer
  1. Yuki Sun-MSFT 41,201 Reputation points Microsoft Vendor
    2023-10-30T02:19:51.4+00:00

    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 additional answers

Sort by: Most helpful
  1. Rich Matheisen 47,496 Reputation points
    2023-10-28T02:23:07.87+00:00

    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. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  3. Sandeep G-MSFT 20,371 Reputation points Microsoft Employee
    2023-10-30T11:06:17.3733333+00:00

    @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.

    https://learn.microsoft.com/en-us/entra/identity/users/groups-dynamic-membership

    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.


Your answer

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