Office 365 Adapter Actions
  • 03 Apr 2023
  • 18 Minutes to read
  • Dark
    Light

Office 365 Adapter Actions

  • Dark
    Light

Article Summary

Office 365 Adapter Actions

These actions use the Microsoft Graph API

For reference, a complete list of filterable attributes can be found here.

Prerequisites:
  • RapidIdentity Cloud version 2023.01.0-hotfix2 or higher
  • RapidIdentity LTS version 2023.0.0-hotfix1 or or higher
  • RapidIdentity Exchange Agent version 2023.03.27 or higher

addOffice365DistributionGroupMember

Add a member to an Office 365 DistributionGroup

PropertyValueDescription
connection*expression, variablethe Office 365 connection
groupIdentity*text, expression, variablethe identity of the DistributionGroup
memberIdentity*text, expression, variablethe identity of the object to add to the DistributionGroup
returnVariableexpression, variablename of the variable to be assigned to the return value
added = addOffice365DistributionGroupMember(session, "testgroup", "johndoe@example.com")

addOffice365MsolGroupMember

Add a member to an Office 365 MsolGroup

PropertyValueDescription
connection*expression, variablethe Office 365 connection
groupIdentity*text, expression, variablethe identity of the MsolGroup
memberIdentity*text, expression, variablethe identity of the object to add to the MsolGroup
returnVariableexpression, variablename of the variable to be assigned to the return value
added = addOffice365MsolGroupMember(session, "testgroup@example.com", "johndoe@example.com")
  • For details regarding the New-MgGroupMember API syntax and field reference, click here

addOffice365MsolRoleMember

Add a member to an Office 365 MsolRole

PropertyValueDescription
connection*expression, variablethe Office 365 connection
groupIdentity*text, expression, variablethe identity of the MsolRole
memberIdentity*text, expression, variablethe identity of the object to add to the MsolRole
returnVariableexpression, variablename of the variable to be assigned to the return value
filter = createRecord()
setRecordFieldValue(filter, "RoleName" "User Account Administrator")
roles = getOffice365MsolRoles(session, filter, 1)
added = addOffice365MsolGroupMember(session, roles[0].ObjectId, "johndoe@example.com")
  • For details regarding the New-MgDirectoryRoleMemberByRef API syntax and field reference, click here

addOffice365SPOSiteGroupMember

Add a member to an Office 365 SharePoint Online Site Group

PropertyValueDescription
connection*expression, variablethe Office 365 connection
site*text, expression, variablethe url of the SharePoint Online Site
groupIdentity*text, expression, variablethe name of the SPOSiteGroup
memberIdentity*text, expression, variablethe login name of the object to add to the SPOSiteGroup
returnVariableexpression, variablename of the variable to be assigned to the return value
added = addOffice365SPOSiteGroupMember(session, "https://example.sharepoint.com/", "MySiteGroup", "JohnDoe@example.com")

deleteOffice365DistributionGroup

Delete an Office 365 DistributionGroup record by Id.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
identity*text, expression, variablethe identity of the Office 365 DistributionGroup to delete
returnVariableexpression, variablename of the variable to be assigned to the return value
deleted = deleteOffice365DistributionGroup(session, "testgroup")

deleteOffice365DistributionGroupMember

Delete a member from an Office 365 DistributionGroup.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
groupIdentity*text, expression, variablethe identity of the DistributionGroup
memberIdentity*text, expression, variablethe identity of the object to delete from the DistributionGroup
returnVariableexpression, variablename of the variable to be assigned to the return value
removed = deleteOffice365DistributionGroupMember(session, "testgroup@example.com", "jdoe@example.com")

deleteOffice365Mailbox

Delete an Office 365 Mailbox record by Id.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
identity*text, expression, variablethe identity of the Office 365 Mailbox to delete
returnVariableexpression, variablename of the variable to be assigned to the return value
deleted = deleteOffice365Mailbox(session, "jdoe@example.com")

deleteOffice365MailContact

Delete an Office 365 MailContact record by Id.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
identity*text, expression, variablethe identity of the Office 365 MailContact to delete
returnVariableexpression, variablename of the variable to be assigned to the return value
deleted = deleteOffice365MailContact(session, "testContact")

deleteOffice365MailUser

Delete an Office 365 MailUser record by Id.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
identity*text, expression, variablethe identity of the Office 365 MailUser to delete
returnVariableexpression, variablename of the variable to be assigned to the return value
deleted = deleteOffice365MailUser(session, "testMailUser@example.com")

deleteOffice365MsolGroup

Delete an Office 365 MsolGroup record by Id.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
identity*text, expression, variablethe identity of the Office 365 MsolGroup to delete
returnVariableexpression, variablename of the variable to be assigned to the return value
deleted = deleteOffice365MsolGroup(session, "testgroup@example.com")
  • For details regarding the Remove-MgGroup API syntax and field reference, click here

deleteOffice365MsolGroupMember

Delete a member from an Office 365 MsolGroup.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
groupIdentity*text, expression, variablethe identity of the MsolGroup
memberIdentity*text, expression, variablethe identity of the object to delete from the MsolGroup
returnVariableexpression, variablename of the variable to be assigned to the return value
deleted = deleteOffice365MsolGroupMember(session, "testgroup@example.com", "jdoe@example.com")
  • For details regarding the Remove-MgGroupMemberByRef API syntax and field reference, click here

deleteOffice365MsolRoleMember

Delete a member from an Office 365 MsolRole.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
groupIdentity*text, expression, variablethe identity of the MsolRole
memberIdentity*text, expression, variablethe identity of the object to delete from the MsolRole
returnVariableexpression, variablename of the variable to be assigned to the return value
filter = createRecord()
setRecordFieldValue(filter, "RoleName" "User Account Administrator")
roles = getOffice365MsolRoles(session, filter, 1)
deleted = deleteOffice365MsolGroupMember(session, roles[0].ObjectId, "jdoe@example.com")
  • For details regarding the Remove-MgDirectoryRoleMemberByRef API syntax and field reference, click here

deleteOffice365MsolUser

Delete an Office 365 MsolUser record by Id.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
identity*text, expression, variablethe identity of the Office 365 MsolUser to delete
returnVariableexpression, variablename of the variable to be assigned to the return value
deleted = deleteOffice365MsolUser(session, "jdoe@example.com")

For details regarding the Remove-MgUser API syntax and field reference, click here

deleteOffice365SPOSiteGroup

Delete an Office 365 SharePoint Online Site Group record by Id.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
site*text, expression, variablethe url of the SharePoint Online Site
identity*text, expression, variablethe name of the Office 365 SharePoint Online Site Group to delete
returnVariableexpression, variablename of the variable to be assigned to the return value
deleted = deleteOffice365SPOSiteGroup(session, "https://example.sharepoint.com/", "MySiteGroup")

deleteOffice365SPOSiteGroupMember

Delete a member from an Office 365 SharePoint Online Site Group.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
site*text, expression, variablethe url of the SharePoint Online Site
groupIdentity*text, expression, variablethe name of the SPOSiteGroup
memberIdentity*text, expression, variablethe login name of the object to delete from the SPOSiteGroup
returnVariableexpression, variablename of the variable to be assigned to the return value
deleted = deleteOffice365SPOSiteGroupMember(session, "https://example.sharepoint.com/", "MySiteGroup", "jdoe@example.com")

getOffice365DistributionGroup

Get an Office 365 DistributionGroup record by Id.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
identity*text, expression, variablethe identity of the Office 365 DistributionGroup to get
returnVariableexpression, variablename of the variable to be assigned to the return value
distGroup = getOffice365DistributionGroup(session, "testgroup")

getOffice365DistributionGroups

Get Office 365 DistributionGroup records.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
filtertext, expression, variablean OPath filter or an example Record
maxResultsexpression, variablemaximum number of Records to return (default: 1000)
returnVariableexpression, variablename of the variable to be assigned to the return value
filter = createRecord()
setRecordFieldValue(filter, "GroupType", "SecurityEnabled")
mailboxes = getOffice365DistributionGroups(session, filter, 50)

getOffice365Mailbox

Get an Office 365 Mailbox record by Identity.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
identity*text, expression, variablethe identity of the Office 365 Mailbox to get
returnVariableexpression, variablename of the variable to be assigned to the return value
mailbox = getOffice365Mailbox(session, "jdoe@example.com")

getOffice365Mailboxes

Get Office 365 Mailbox records.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
filtertext, expression, variablean OPath filter or an example Record
maxResultsexpression, variablemaximum number of Records to return (default: 1000)
returnVariableexpression, variablename of the variable to be assigned to the return value
filter = createRecord()
setRecordFieldValue(filter, "LastName", "Doe")
setRecordFieldValue(filter, "FirstName", "John")

mailboxes = getOffice365Mailboxes(session, filter, 2)

getOffice365MailContact
Get an Office 365 MailContact record by Id.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
identity*text, expression, variablethe identity of the Office 365 MailContact to get
returnVariableexpression, variablename of the variable to be assigned to the return value
contact = getOffice365MailContact(session, "testContact")

getOffice365MailContacts

Get Office 365 MailContact records.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
filtertext, expression, variablean OPath filter or an example Record
maxResultsexpression, variablemaximum number of Records to return (default: 1000)
returnVariableexpression, variablename of the variable to be assigned to the return value
filter = createRecord()
setRecordFieldValue(filter, "LastName", "Doe")
setRecordFieldValue(filter, "FirstName", "John")
mailboxes = getOffice365MailContacts(session, filter, 2)

getOffice365MailUser

Get an Office 365 MailUser record by Id.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
identity*text, expression, variablethe identity of the Office 365 MailUser to get
returnVariableexpression, variablename of the variable to be assigned to the return value
mailUser = getOffice365MailUser(session, "testMailUser")

getOffice365MailUsers

Get Office 365 MailUser records.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
filtertext, expression, variablean OPath filter or an example Record
maxResultsexpression, variablemaximum number of Records to return (default: 1000)
returnVariableexpression, variablename of the variable to be assigned to the return value
filter = createRecord()
setRecordFieldValue(filter, "LastName", "Doe")
setRecordFieldValue(filter, "FirstName", "John")
mailboxes = getOffice365MailUsers(session, filter, 2)

getOffice365MsolGroup

Get an Office 365 MsolGroup record by Id.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
identity*text, expression, variablethe identity of the Office 365 MsolGroup to get
returnVariableexpression, variablename of the variable to be assigned to the return value
filter = createRecord() setRecordFieldValue(filter, "GroupType", "Security") mailboxes = getOffice365MsolGroups(session, filter, 50)

For details regarding the Get-MgGroup API syntax and field reference, click here

Recent Changes:

  • The “Identity”/”DisplayName” field was used as the unique identifier for Microsoft Online, but the “Id” field is used by Microsoft Graph. The Exchange Agent will automatically handle this change when retrieving a specific group (i.e. A group can be found by providing either “DisplayName” or “Id”).
  • The “Identity” field will no longer be returned on the group objects. If the value is needed in Connect logic, utilize “DisplayName” or “Id” instead.
  • The “Id” field is now returned by group objects and should be used to reference groups

getOffice365MsolGroups

Get Office 365 MsolGroup records.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
filtertext, expression, variablean example Record
maxResultsexpression, variablemaximum number of Records to return (default: 1000)
returnVariableexpression, variablename of the variable to be assigned to the return value
filter = createRecord()
setRecordFieldValue(filter, "GroupType", "Security")
mailboxes = getOffice365MsolGroups(session, filter, 50)

For details regarding the Get-MgGroup API syntax and field reference, click here

Recent Changes:

  • The “Identity” field will no longer be returned on the group objects. If the value is needed in Connect logic, utilize “DisplayName” or “Id” instead.
  • The “Id” field is now returned by group objects and should be used to reference groups

Filter Changes

  • Careful consideration should be taken when updating Connect action sets utilizing the optional filter parameter. Microsoft provides documentation for using filters

getOffice365MsolRole

Get an Office 365 MsolRole record by Id.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
identity*text, expression, variablethe identity of the Office 365 MsolRole to get
returnVariableexpression, variablename of the variable to be assigned to the return value
role = getOffice365MsolRole(session, "fe930be7-5e62-47db-91af-98c3a49a38b1")

​For details regarding the Get-MgDirectoryRole API syntax and field reference, click here

Notes:

  • You may find that not all roles returned from Get-MsolRole are returned by Get-MgDirectoryRole. If this is the case, look at the “Import MsolRoles to MgDirectoryRoles” section for reference.

getOffice365MsolRoles

Get Office 365 MsolRole records.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
filtertext, expression, variablean example Record
returnVariableexpression, variablename of the variable to be assigned to the return value
filter = createRecord()
setRecordFieldValue(filter, "RoleName" "User Account Administrator")
roles = getOffice365MsolRoles(session, filter, 1)

For details regarding the Get-MgDirectoryRole API syntax and field reference, click here

getOffice365MsolUser

Get an Office 365 MsolUser record by Identity.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
identity*text, expression, variablethe identity of the Office 365 MsolUser to get
returnVariableexpression, variablename of the variable to be assigned to the return value
user = getOffice365MsolUser(session, "jdoe@example.com")

For details regarding the Get-MgUser API syntax and field reference, click here

getOffice365MsolUsers

Get Office 365 MsolUser records.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
filtertext, expression, variablean example Record
maxResultsexpression, variablemaximum number of Records to return (default: 1000)
returnVariableexpression, variablename of the variable to be assigned to the return value
filter = createRecord()
setRecordFieldValue(filter, 'Filter', 'startsWith(DisplayName, "Mi")')
users = getOffice365MsolUsers(session, filter, 200)

For details regarding the Get-MgUser API syntax and field reference, click here

Notes:

  • Careful consideration should be taken when updating Connect action sets utilizing the optional filter parameter. Microsoft provides documentation for using filters.

getOffice365SPOSiteGroup

Get an Office 365 SharePoint Online Site Group record by Id.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
site*text, expression, variablethe url of the SharePoint Online Site
identity*text, expression, variablethe name of the Office 365 SharePoint Online Site Group to get
returnVariableexpression, variablename of the variable to be assigned to the return value
siteGroup = getOffice365SPOSiteGroup(session, "https://example.sharepoint.com/", "MySiteGroup")

getOffice365SPOSiteGroups

Get Office 365 SharePoint Online Site Group records.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
site*text, expression, variablethe url of the SharePoint Online Site
maxResultsexpression, variablemaximum number of Records to return (default: 200)
returnVariableexpression, variablename of the variable to be assigned to the return value
siteGroups = getOffice365SPOSiteGroups(session, "https://example.sharepoint.com/", 50)

openOffice365Connection

Open a connection to Office 365.

PropertyValueDescription
office365AgentURL*text, expression, variablethe URL of the Exchange Administrative Web Service agent (e.g. https://hostname:port/idautoExchangeAdminWS)
noExchangeboolean, expression, variableset to true for domains that don't support Exchange Online (default: false)
spoAdminURLtext, expression, variablethe URL of the SharePoint Online Administration Center (e.g. https://mycompany-admin.sharepoint.com)
username*text, expression, variableusername for authentication to Office 365
password*password, string, expression, variablepassword for authentication to Office 365
optionsexpression, variableA record or JavaScript object with a field for each additional option. Currently defined fields are connectTimeout and socketTime which require a numeric value from 1 to 2147483647 (0x7FFFFFFF) that represents the number of milliseconds for the timeout, and 0 representing no timeout.
returnVariableexpression, variablename of the variable to be assigned to the return value
Global.office365URL = "https://10.10.10.10/idautoExchangeAdminWS"
Global.office365User = "office365admin@example.net"
Global.office365Pwd = <Password>
session = openOffice365Connection(Global.office365URL,Global.office365User, Global.office365Pwd)

purgeOffice365UserRecycleBin

Purge deleted users from Office 365 Recycle Bin.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
returnVariableexpression, variablename of the variable to be assigned to the return value
purgeOffice365UserRecycleBin(session)

saveOffice365DistributionGroup

Create/Update an Office 365 DistributionGroup record.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
record*expression, variablethe record to save
returnVariableexpression, variablename of the variable to be assigned to the return value
groupTemplate = createRecord(, )
setRecordFieldValue(groupTemplate, "Name", "testgroup")
saveOffice365DistributionGroup(session, groupTemplate)

saveOffice365Mailbox

Create/Update an Office 365 Mailbox record.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
record*expression, variablethe record to save
returnVariableexpression, variablename of the variable to be assigned to the return value
mailboxTemplate = createRecord()
setRecordFieldValue(mailboxTemplate, "Name", "JDoe")
setRecordFieldValue(mailboxTemplate, "Password",Password>)
setRecordFieldValue(mailboxTemplate, "MicrosoftOnlineServicesID", johndoe@example.com")
mailbox = saveOffice365Mailbox(session, mailboxTemplate)

saveOffice365MailContact

Create/Update an Office 365 MailContact record.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
record*expression, variablethe record to save
returnVariableexpression, variablename of the variable to be assigned to the return value
contactTemplate = createRecord()
setRecordFieldValue(contactTemplate, "Name", "testContact")
setRecordFieldValue(contactTemplate, "ExternalEmailAddress", "testContact@example.com")
contact = saveOffice365MailContact(session, contactTemplate)

saveOffice365MailUser

Create/Update an Office 365 MailUser record.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
record*expression, variablethe record to save
returnVariableexpression, variablename of the variable to be assigned to the return value
mailUserTemplate = createRecord()
setRecordFieldValue(mailUserTemplate, "EmailAddresses", "testMailUser@example.org")
mailUser = saveOffice365MailUser(session, mailUserTemplate)

saveOffice365MsolGroup

Create/Update an Office 365 MsolGroup record.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
record*expression, variablethe record to save
returnVariableexpression, variablename of the variable to be assigned to the return value
groupTemplate = createRecord()
setRecordFieldValue(groupTemplate, "DisplayName", "testGroup")
group = saveOffice365MsolGroup(session, groupTemplate)
  • For details regarding the New-MgGroup API syntax and field reference, click here
  • For details regarding the Update-MgGroup API syntax and field reference, click here

Recent Changes

New Group Fields

  • DisplayName
    • It’s unlikely that groups were being created without the “DisplayName” field, but it was not required with Microsoft Online and is required by Microsoft Graph
  • MailNickname
    • This is a new field in Microsoft Graph. The Exchange Agent will set the “MailNickname” field to the “DisplayName” value if it is not specified.
  • MailEnabled
    • This is a new field in Microsoft Graph. The Exchange Agent will set the “MailEnabled” field to “false” if not specified.
  • SecurityEnabled
    • This is a new field in Microsoft Graph. The Exchange Agent will set the “MailEnabled” field to “true” if not specified.

Notes:

  • Special consideration should be taken when updating the “DisplayName” for a group (i.e. may also want to consider updating “MailNickname”).
    • See bullet point above regarding “MailNickname” not being specified on group create

saveOffice365MsolUser

Create/Update an Office 365 MsolUser record.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
record*expression, variablethe record to save
returnVariableexpression, variablename of the variable to be assigned to the return value
userTemplate = createRecord()
setRecordFieldValue(userTemplate, "GivenName","Homer"
setRecordFieldValue(userTemplate, "Surname", "Simpson"
setRecordFieldValue(userTemplate, "DisplayName", "Homey")
setRecordFieldValue(userTemplate, "Password",<//Password//>)
setRecordFieldValue(userTemplate, "FaxNumber", "555-call-homr")
setRecordFieldValue(userTemplate, "OfficeLocation", "Power Plant")
setRecordFieldValue(userTemplate, "UserPrincipleName", "Homey@" + testDomain)
setRecordFieldValue(userTemplate, "UsageLocation", "US")
setRecordFieldValue(userTemplate, "LicenseAssignment", "mydomain:ENTERPRISEPACK")
msolUser = saveOffice365MsolUser(session, userTemplate)

For details regarding the New-MgUser API syntax and field reference, click here
For details regarding the Update-MgUser API syntax and field reference, click here

Recent Changes:

New User Fields

  • AccountEnabled
    • This is a new field in Microsoft Graph. The Exchange Agent will set the “AccountEnabled” field to “true” if not specified.
  • MailNickname
    • This is a new field in Microsoft Graph. The Exchange Agent will set the “MailNickname” field to the “DisplayName” value if it is not specified.
  • Password
    • If you create users without a password, you will need to update your Connect logic to supply a random password. Microsoft Online would automatically generate a random password when creating users without “Password” specified, but this is not the case with Microsoft Graph.

User Field Changes

  • “FirstName” will be “GivenName”
  • “LastName” is now “Surname”
  • “Fax” is now “FaxNumber"
  • “Office” is now “OfficeLocation”

Notes:

  • Special consideration should be taken when updating the “DisplayName” for a user (i.e. may also want to consider updating “MailNickname”).
    • See bullet point above regarding “MailNickname” not being specified on user create
  • The “LicenseOptions” field will no longer accept an “AccountSkuId” in its JSON objects. Instead, it will accept “SkuId” or “SkuPartNumber”.
    • “LicenseOptions” are used for disabling specific plans within a license (e.g. “[{“SkuId”:”SkuId1”,”DisabledPlans”:[“YAMMER_ENTERPRISE”]}]”)

saveOffice365SPOSiteGroup

Create/Update an Office 365 SharePoint Online Site Group record.

PropertyValueDescription
connection*expression, variablethe Office 365 connection
record*expression, variablethe record to save
returnVariableexpression, variablename of the variable to be assigned to the return value

Import MsolRoles to MgDirectoryRoles

The following PowerShell script provides an example of how to import MSOL roles into Microsoft Graph. Run this in an Administrator PowerShell on the Windows machine where the Exchange Agent is installed with the appropriate credentials.

> $user = "admin_user@domain.onmicrosoft.com"
> $password = ConvertTo-SecureString 'password123' -AsPlainText -Force
> $basicCred = New-Object System.Management.Automation.PsCredential($user,$password)
> Connect-MsolService -Credential $basicCred
> $appId = "<azure_app_id>"
> $tenantId = "<azure_tenant_id>"
> $certThumbprint = "<cert_thumbprint>"
> $certPath = 'Cert:\LocalMachine\My\' + $certThumbprint
> $cert = Get-ChildItem -Path $certPath
> Connect-MgGraph -ClientId $appId -TenantId $tenantId -Certificate $cert
> Get-MsolRole | ForEach-Object {
    $template = (Get-MgDirectoryRoleTemplate -DirectoryRoleTemplateId $_.ObjectId)
    if ($template -ne $null) {
   	 $filter = "RoleTemplateId eq '" + $template.Id + "'"
   	 $role = Get-MgDirectoryRole -Filter $filter
   	 if ($role -eq $null) {
   		 New-MgDirectoryRole -RoleTemplateId $role.Id
   	 }
    }

Important Notes

  • Office 365 supports a new higher-level management object, MsolUser, that should be preferred to managing users via the Mailbox object.
  • While a Mailbox can still be created directly, the corresponding MsolUser must be assigned a license or the Mailbox will be disabled after a grace period.
    • The corresponding MsolUser is not available immediately (probably due to AD replication latency) so immediately trying to add a license after creating a Mailbox directly will usually fail.
    • Creating a Mailbox directly requires the field MicrosoftOnlineServicesID as opposed to WindowsLiveID (Live@EDU) or UserPrincipalName (Exchange).
  • After a MsolUser is created and assigned an appropriate license, a Mailbox will be automatically created after some delay.
  • While an initial password can still be set when creating a Mailbox, subsequent password changes can only be made to the MsolUser.
  • Setting the initial password on a MsolUser uses the Password field, but subsequent password changes can use either the Password or NewPassword field.
  • Licenses can be added on the initial creation of MsolUser using the LicenseAssignment field. Subsequent addition or removal of licenses use the AddLicenses or RemoveLicense field. In either case, assigning a license will fail if the UsageLocation field has not been set.
  • The licenses available for assignment for a particular domain can be determined by going to the server hosting the Exchange agent and opening the “Microsoft Online Services Module for Windows PowerShell” from the desktop. Then run the following commands:
    Connect-MsolService -Credential ( Get-Credential )
    (Get-MsolAccountSku).AccountSkuid
    
  • You can disable specific applications that would normally be enabled by a license using the LicenseOptions field. The LicenseOptions field is a record that has two fields: AccountSkuID, which is the name of the license; and DisabledPlans, which is an array of the names of specific modules to be disabled for the user. The names of the modules that are available within a given license can be determined by going to the server hosting the Exchange agent and opening the “Microsoft Online Services Module for Windows PowerShell” from the desktop. Then run the following commands:
    Connect-MsolService -Credential ( Get-Credential )
    forEach ( $sku in Get-MsolAccountSku) {
    echo $sku;
    forEach ( $service in $sku.ServiceStatus) {
    echo $service.ServicePlan.ServiceName}
    }
    
  • Creating a MsolGroup will create a security group (as opposed to a distribution group), after initial creation, MsolGroup can be used for listing or adding/removing members from both security and distribution groups.
  • There is a timing issue with user creation on the Office 365 backend. We are recommending that you not set Location, Time Zone, or Language at user creation time. If you wish to set these attributes you should update them in a later action.

Was this article helpful?


What's Next