Share via

Use AADConnect to Populate Office 365 Usage Location

So, a million years and tens of thousands of lines of code ago, I wrote a script for a customer to populate the Office 365 UsageLocation property (Set-MsolUser -UsageLocation) with the ISO country codes from Active Directory.  In Office 365, UsageLocation is used to determine what features are available to your users.

If you have the Country Code populated in Office 365, we can flow that value in to Azure AD.  But what if you *don't* have a country code set for everyone and just want it to be set to US if it's blank?

Here's a rule that will do just that.

  1. Launch the Synchronization Rules Editor.
  2. Under Rule Types, click Inbound, and then click Add New Rule.
  3. Under Connected System, select the connector that represents your Active Directory.
  4. Make the following selections:
    1. Connected System Object Type: user
    2. Metaverse Object Type: person
    3. Link Type: Join
    4. Precedence:  <any value lower than the default rules >
  5. Click Next.
  6. On the Scoping Filter page, click Next.
  7. On the Join Rules page, click Next.
  8. On the Transformations page, do one of the following:
    1. If you want everyone to get the same usage location regardless of country code in Office 365, make the following selections:
      1. Flow Type: Constant
      2. Target Attribute: usageLocation
      3. Source: US
    2. If you want to only flow a certain value if the field is blank, make the following selections:
      1. Flow Type: Expression
      2. Target Attribute: usageLocation
      3. Source: IIF(IsNullOrEmpty([c]),"US",[c]) UL-03b
  9. Click Save.

Word to the wise: If you are populating AD with the country code value,  make sure you are using the appropriate ISO 3166-2 country code.