Hello Tim,
To create such a Business Unit, first, you need to somehow mark users who have licenses in Office 365. For this purpose, we suggest using a certain AD property that you don't use for other properties. For example, if yo have Exchange installed on premises, that can be an Exchange Extension Attribute, for example, extensionAttribute1. You can set it to a certain predefined value, for example, licensed. Note that it must be an actual value that exists in your AD to be able to build a Business Unit based on it. You cannot use an Adaxes Custom Attribute here because searching by such attributes is not supported. You won't be able to build a Business Unit based on Adaxes Custom Attributes.
To implement such a solution, you will need to:
- Create a Custom Command that will set the value of extensionAttribute1 depending on whether a user is licensed.
- Create a Business Rule that runs the Custom Command after updating Office 365 properties of a user.
- Create a Scheduled Task that runs the Custom Command periodically. This is required to update the attribute for users whose licenses were assigned / revoked outside of Adaxes (e.g. via the Office 365 Portal). Also, it will mark users who already exist in your AD and have Office 365 licenses by the time you implement this process. We recommend running it a couple of times a day.
- Create a Business Unit that includes all users who have extensionAttribute1 set to licensed.
i. Create Custom Command
To create a the Custom Command that sets the value of extensionAttribute1 depending on whether a user is licensed:
- Create a new Custom Command.
- On step 1 of the Create Custom Command Wizard, enter a name and an optional description for the command. Untick the Enabled option so that the Custom Command would be hidden from the UI.
- On step 2, select User.
- On step 3, add the Update the User action and click Add.
- In the Property to modify drop-down list, select Extension Attribute 1.
- In the New value field, specify licensed and click OK 2 times.
- Right-click the action you've just added and click Add Condition.
- Select If licensed for Office 365 and make sure that is option is selected. When done, click OK.
- Right-click the action and click Add Condition again.
- Select If <property> <relation> <value>.
- Specify If Extension Attribute 1 does not equal licensed. When done, click OK.
- Click the Add action to a new set link.
- Select the Update the User action and click Add.
- Select Remove the property. And click OK 2 times.
- Right-click the action you've just added and click Add Condition.
- Select If licensed for Office 365 and select is not. Click OK.
- Right-click the action and click Add Condition again.
- Select If <property> <relation> <value>.
- Specify If Extension Attribute 1 is not empty.
- When done, click OK. You should receive something like this:
- Click Next, then click Finish.
ii. Create Business Rule
To create a Business Rule that executes the Custom Command after updating Office 365 properties:
- Create a new Business Rule.
- On step 2 of the Create Business Rule Wizard, select User and After Modifying Office 365 properties of a User.
- On step 3, add the Execute a Custom Command action.
- Click Select.
- Select the Custom Command you created on step i.
- Click OK 2 times and finish creation of the Business Rule.
iii. Create Scheduled Task
To create a Scheduled Task that executes the Custom Command on a periodical basis:
- Create a new Business Rule.
- On step 3 of the Create Scheduled Task Wizard, select User.
- On step 4, add the Execute a Custom Command action.
- Click Select.
- Select the Custom Command you created on step i.
- Click OK 2 times and finish the task creation.
iv. Create Business Unit
Finally, to create a Business Unit that includes all users licensed for Office 365:
-
Create a new Business Unit.
-
On step 2 of the Create Business Unit Wizard, click Add.
-
Select Query Results.
-
In the Filter field, enter the following LDAP filter:
(&(sAMAccountType=805306368)(extensionAttribute1=licensed))
-
Click Finish.