Automatically Assign Office 365 Licenses
With the help of Adaxes, you can automatically activate and deactivate user accounts in Office 365, as well as assign and revoke licenses for Office 365 services. In this tutorial, you will learn how to assign Office 365 licenses as a part of the user provisioning process. Also, you will learn how to assign different licenses to different categories of users depending on a certain attribute of their account.
Before you can start using Adaxes for Office 365 management, you need to register an Office 365 tenant.
You will be able to manage Office 365 accounts of only those users who fall within the Associated Active Directory Scope of an Office 365 tenant. Make sure to adjust the AD scope of your Office 365 tenant as appropriate.
For user provisioning, Adaxes has a built-in Business Rule called After User Creation. Once a new user is created, it performs common tasks related to provisioning the user, among which is activating an Office 365 account for the user. To configure how the Business Rule creates accounts in Office 365:
- Launch Adaxes Administration Console.
- Expand Adaxes service \ Configuration \ Business Rules \ Builtin.
Select the After User Creation Business Rule.
By default, the Business Rule is disabled. This means that the Business Rule will not perform any actions until you enable it.
How to enable
Before enabling the Business Rule, configure the other actions, besides the Activate an Office 365 account for the User action, to meet your requirements and/or delete the ones that you don't need.
- Right-click the Business Rule.
- Select All Tasks in the context menu.
Double-click the Activate an Office 365 account for the User action.
Alternatively, you can create another Business Rule for Office 365 license assignment. For information on how to create such a rule, see Automatically Add Users to Groups by Department. For the Business Rule to assign Office 365 licenses, you need to add the Activate or modify Office 365 account action on Step 3 of the Create Business Rule wizard.
Since the Business Rule will activate Office 365 accounts, make sure that the Activate option is selected in the lower part of the Edit Action dialog.
In the right-hand part of the dialog, specify the following parameters of Office 365 accounts that will be created by the Business Rule:
Location: specify a 2-letter country code that will be associated with Office 365 users (for example, US or DE). Office 365 will use this information to select the nearest available datacenter for the users and apply licensing restrictions for the services.
Full list of country codes
Country Country Code Afghanistan AF Aland Islands AX Albania AL Algeria DZ American Samoa AS Andorra AD Angola AO Anguilla AI Antarctica AQ Antigua and Barbuda AG Argentina AR Armenia AM Aruba AW Australia AU Austria AT Azerbaijan AZ Bahamas BS Bahrain BH Bangladesh BD Barbados BB Belarus BY Belgium BE Belize BZ Benin BJ Bermuda BM Bhutan BT Bolivia, Plurinational State of BO Bonaire, Sint Eustatius and Saba BQ Bosnia and Herzegovina BA Botswana BW Bouvet Island BV Brazil BR British Indian Ocean Territory IO Brunei Darussalam BN Bulgaria BG Burkina Faso BF Burundi BI Cambodia KH Cameroon CM Canada CA Cabo Verde CV Cayman Islands KY Central African Republic CF Chad TD Chile CL China CN Christmas Island CX Cocos (Keeling) Islands CC Colombia CO Comoros KM Congo CG Congo, the Democratic Republic of the CD Cook Islands CK Costa Rica CR Cote d'Ivoire CI Croatia HR Cuba CU Curacao CW Cyprus CY Czech Republic CZ Denmark DK Djibouti DJ Dominica DM Dominican Republic DO Ecuador EC Egypt EG El Salvador SV Equatorial Guinea GQ Eritrea ER Estonia EE Ethiopia ET Falkland Islands (Malvinas) FK Faroe Islands FO Fiji FJ Finland FI France FR French Guiana GF French Polynesia PF French Southern Territories TF Gabon GA Gambia GM Georgia GE Germany DE Ghana GH Gibraltar GI Greece GR Greenland GL Grenada GD Guadeloupe GP Guam GU Guatemala GT Guernsey GG Guinea GN Guinea-Bissau GW Guyana GY Haiti HT Heard Island and McDonald Islands HM Holy See (Vatican City State) VA Honduras HN Hong Kong HK Hungary HU Iceland IS India IN Indonesia ID Iran, Islamic Republic of IR Iraq IQ Ireland IE Isle of Man IM Israel IL Italy IT Jamaica JM Japan JP Jersey JE Jordan JO Kazakhstan KZ Kenya KE Kiribati KI Korea, Democratic People's Republic of KP Korea, Republic of KR Kuwait KW Kyrgyzstan KG Lao People's Democratic Republic LA Latvia LV Lebanon LB Lesotho LS Liberia LR Libya LY Liechtenstein LI Lithuania LT Luxembourg LU Macao MO Macedonia, the former Yugoslav Republic of MK Madagascar MG Malawi MW Malaysia MY Maldives MV Mali ML Malta MT Marshall Islands MH Martinique MQ Mauritania MR Mauritius MU Mayotte YT Mexico MX Micronesia, Federated States of FM Moldova, Republic of MD Monaco MC Mongolia MN Montenegro ME Montserrat MS Morocco MA Mozambique MZ Myanmar MM Namibia NA Nauru NR Nepal NP Netherlands NL New Caledonia NC New Zealand NZ Nicaragua NI Niger NE Nigeria NG Niue NU Norfolk Island NF Northern Mariana Islands MP Norway NO Oman OM Pakistan PK Palau PW Palestine, State of PS Panama PA Papua New Guinea PG Paraguay PY Peru PE Philippines PH Pitcairn PN Poland PL Portugal PT Puerto Rico PR Qatar QA Reunion RE Romania RO Russian Federation RU Rwanda RW Saint Barthelemy BL Saint Helena, Ascension and Tristan da Cunha SH Saint Kitts and Nevis KN Saint Lucia LC Saint Martin (French part) MF Saint Pierre and Miquelon PM Saint Vincent and the Grenadines VC Samoa WS San Marino SM Sao Tome and Principe ST Saudi Arabia SA Senegal SN Serbia RS Seychelles SC Sierra Leone SL Singapore SG Sint Maarten (Dutch part) SX Slovakia SK Slovenia SI Solomon Islands SB Somalia SO South Africa ZA South Georgia and the South Sandwich Islands GS South Sudan SS Spain ES Sri Lanka LK Sudan SD Suriname SR Svalbard and Jan Mayen SJ Swaziland SZ Sweden SE Switzerland CH Syrian Arab Republic SY Taiwan, Province of China TW Tajikistan TJ Tanzania, United Republic of TZ Thailand TH Timor-Leste TL Togo TG Tokelau TK Tonga TO Trinidad and Tobago TT Tunisia TN Turkey TR Turkmenistan TM Turks and Caicos Islands TC Tuvalu TV Uganda UG Ukraine UA United Arab Emirates AE United Kingdom GB United States US United States Minor Outlying Islands UM Uruguay UY Uzbekistan UZ Vanuatu VU Venezuela, Bolivarian Republic of VE Viet Nam VN Virgin Islands, British VG Virgin Islands, U.S. VI Wallis and Futuna WF Western Sahara EH Yemen YE Zambia ZM Zimbabwe ZW
If a country is not specified for a user in AD, the %c% value reference will be resolved into an empty value, and thus location will not be specified for the user. Office 365 does not allow assigning licenses to users whose location is not specified. To avoid such a situation, it is recommended to make the Country property required.
For information on how to make a certain property required, see Make Employee ID a Required Property & Specify its Format.
If you want to set the location based on another property, instead of %c%, use a value reference for the property you need. For example, if location is stored in the Extension Attribute 1 property, use the following value reference: %extensionAttribute1%.
Licenses: select the Office 365 licenses that will be assigned to users.
A user will be assigned an Office 365 license only if the Office 365 tenant within which the user's Office 365 account is created is signed up for a license plan for such an Office 365 service.
If necessary, customize the rest of the actions in the Business Rule and/or add your own actions and conditions. When finished, click Save changes.
Assign Different Licenses to Different Users
If necessary, you can assign Office 365 licenses based on certain conditions. For instance, you can provide licenses for Office 365 services only if a user is a manager or supervisor, or if the user's account is located in a certain Organizational Unit. The best practice is to create a Custom Command containing the actions and conditions that are necessary to assign the appropriate licenses, and execute that Custom Command by a Business Rule that is triggered on user creation. This also gives you the opportunity to assign licenses from other Business Rules and Scheduled Tasks by simply calling the Custom Command.
Right-click your Adaxes service, point to New and click Custom Command.
Enter the name (label) for the new Custom Command. If you are not planning to launch the Custom Command manually, uncheck the Enabled option. Click Next.
Select User in the Object Type list and click Next.
At the next step, you need to specify what the Custom Command will do. To assign Office 365 licenses with the help of the Custom Command:
- Click the Add Action link.
- Select the Activate or modify Office 365 account action.
- Select the Modify properties option in the lower part of the dialog.
- Click the Office 365 properties button.
In the Office 365 Properties dialog, you need to specify which parameters of Office 365 accounts will be modified by the action.
To assign a license, check the 1st and the 2nd checkboxes for the appropriate license.
To revoke a license, check only the 1st checkbox, and leave the 2nd checkbox unchecked.
Since the action can be used for activating new user accounts in Office 365, and Office 365 does not allow assigning licenses to users whose location is not specified, you need to configure the action to set the location for users. To do this, check the Location option and specify a 2-letter country code in the associated edit box. If you want to set the same location as the country specified for a user in AD, use the %c% value reference.For more details on setting location to Office 365 users, see Location.
To assign specific licenses only if certain conditions are met, for example, if the user's Job Title contains Manager, you need to add a condition:
- Double-click Always.
- Select the If <property><relation><value> condition type.
In the Condition Parameters section, specify Job Title contains Manager.
Click OK. You'll see something like this:
Apart from assigning Office 365 licenses to users with a certain job title, you also need to revoke the licenses once a user's job title changes. Thus, for example, if you assign certain Office 365 licenses only to managers, you also need to revoke them from users whose new job title does not contain Manager. To do this, you need to add an action that revokes the licenses and a condition that allows executing the action only when a user's job title does not contain Manager. To add a new action/condition set, click the Add action to a new set link.
If necessary, add actions and conditions to configure assignment of licenses to users with other job titles.
When finished, click Next. Then, click Finish.
Update the After User Creation Business Rule. Instead of the Activate or modify Office 365 account action, it must execute the Custom Command created on step 1.
To automatically update Office 365 licenses once a user account is modified, for example, once the user's job title changes, create a Business Rule triggered after updating users that executes the Custom Command.
For the rule to be triggered only when a user's job title changes, add If the 'Job Title' property has changed condition.
If you distribute Office 365 licenses based on where AD user accounts are located, to update the licenses once a user is moved to another location, you need to create a Business Rule that will be executed after moving users and add the Execute Custom Command action to that Business Rule.
If users are created, modified or moved outside Adaxes, Business Rules will not be triggered. To grant appropriate Office 365 licenses to those users as well, create a Scheduled Task that will periodically execute the Custom Command.
For details on how to create Scheduled Tasks, see Schedule Tasks for Active Directory Management.
Deprovisioning Office 365 Accounts
To revoke Office 365 licenses when an employee leaves, you can use built-in Custom Command called Deprovision. By default, it already contains an action that revokes all licenses from a user and deactivates the user's account in Office 365.
For information on how to configure the other actions, see Configure User Deprovisioning.