Idira Identity: Office 365 provisioning script to sync users and groups based on the OU they are in

Idira Identity: Office 365 provisioning script to sync users and groups based on the OU they are in

79
Created On 11/10/26 11:01 AM - Last Modified 11/10/26 12:59 PM


Question


Does Idira Identity provide a method to only provision to Office 365 users and groups that are in a specific OU?
 


Environment


Identity App Access Service

Answer


The Idira Identity connector can provide support for both trusted and individual domain configurations. In both case, administrators may wish to prevent provisioning actions. To exclude object types, the provisioning script within the Cloud Manager application can be modified to exclude objects based on a variety of variables such as name, location and domain to name a few available options.

To configure the provisioning script to only include AD users and groups that are in a specific OU:
  1. In Cloud Manager, go to the Apps page and open your Office 365 application.
  2. On the Provisioning page, scroll to the Provisioning script section, and click the downward arrow in the heading.
  3. Modify the provisioning script to exclude an object from synchronization by calling the reject statement.
  4. For example, if only users and groups that are in the OU "OUname" at the root need to be included, the following script can be used:
 
//for users:
trace('DisplayName=' + destination.DisplayName);

if (isPerson()) {
    destination.UsageLocation = "US";
var dnArray = getSourcePropertyByName("distinguishedname");
if (dnArray && dnArray.Length) {
var dn = String(dnArray[0]).toLowerCase();
trace("source.dn=" + dn);
//ouname should be entered in lower case
if (dn.indexOf(",ou=ouname,dc=domain,dc=com")>=0) {
trace('User IS in the OU we want to synchronize to Office 365');
} else {
trace("User is NOT in the OU we want to synchronize to Office 365");
reject("User is NOT in the OU we want to synchronize to Office 365");
}
}
}


//for groups:
if (isGroup()) {
var dnArray = getSourcePropertyByName("distinguishedname");
if (dnArray && dnArray.Length) {
var dn = String(dnArray[0]).toLowerCase();
trace("source.dn=" + dn);
//ouname should be entered in lower case
if (dn.indexOf(",ou=ouname,dc=domain,dc=com")>=0) {
trace('Group IS in the OU we want to synchronize to Office 365');
} else {
trace("Group is NOT in the OU we want to synchronize to Office 365");
reject("Group is NOT in the OU we want to synchronize to Office 365");
}
}
}

Administrators can test the script filtering by configuring Office 365 provisioning for "Preview Mode" (optional) and performing a manual sync. After provisioning is complete and a report is generated, administrators can review the
report for events that contain ProvisioningScript as displayed in the below example for excluding users and groups that are not in the OU OUname:

User:
ProvisioningScript: DisplayName=newuser
ProvisioningScript: source.dn=cn=newuser,ou=mac,dc=domain,dc=com
ProvisioningScript: User is NOT in the OU we want to synchronize to Office 365
ProvisioningScript: Provisioning script object was rejected. Reason: User is NOT in the OU we want to synchronize to Office 365
SyncUserInternal: newuser@domain.com is user record sync rejected: User is NOT in the OU we want to synchronize to Office 365
Not syncing newuser@domain.com due to: User is NOT in the OU we want to synchronize to Office 365
Group:
ProvisioningScript: DisplayName=null
ProvisioningScript: source.dn=cn=grouptest,ou=mac,dc=domain,dc=com
ProvisioningScript: Group is NOT in the OU we want to synchronize to Office 365
ProvisioningScript: Provisioning script object was rejected. Reason: Group is NOT in the OU we want to synchronize to Office 365

 

Note: if restriction based on the domain is needed instead, please see following KB article: Idira Identity: Configuring Office 365 to exclude AD groups from synchronizing based on the domain name



Additional Information


Details

Question:

Does Idira Identity provide a method to only provision to Office 365 users and groups that are in a specific OU?



Answer:

The Idira Identity connector can provide support for both trusted and individual domain configurations. In both case, administrators may wish to prevent provisioning actions. To exclude object types, the provisioning script within the Cloud Manager application can be modified to exclude objects based on a variety of variables such as name, location and domain to name a few available options.

To configure the provisioning script to only include AD users and groups that are in a specific OU:
  1. In Cloud Manager, go to the Apps page and open your Office 365 application.
  2. On the Provisioning page, scroll to the Provisioning script section, and click the downward arrow in the heading.
  3. Modify the provisioning script to exclude an object from synchronization by calling the reject statement.
  4. For example, if only users and groups that are in the OU "OUname" at the root need to be included, the following script can be used:
 
//for users:
trace('DisplayName=' + destination.DisplayName);

if (isPerson()) {
    destination.UsageLocation = "US";
var dnArray = getSourcePropertyByName("distinguishedname");
if (dnArray && dnArray.Length) {
var dn = String(dnArray[0]).toLowerCase();
trace("source.dn=" + dn);
//ouname should be entered in lower case
if (dn.indexOf(",ou=ouname,dc=domain,dc=com")>=0) {
trace('User IS in the OU we want to synchronize to Office 365');
} else {
trace("User is NOT in the OU we want to synchronize to Office 365");
reject("User is NOT in the OU we want to synchronize to Office 365");
}
}
}


//for groups:
if (isGroup()) {
var dnArray = getSourcePropertyByName("distinguishedname");
if (dnArray && dnArray.Length) {
var dn = String(dnArray[0]).toLowerCase();
trace("source.dn=" + dn);
//ouname should be entered in lower case
if (dn.indexOf(",ou=ouname,dc=domain,dc=com")>=0) {
trace('Group IS in the OU we want to synchronize to Office 365');
} else {
trace("Group is NOT in the OU we want to synchronize to Office 365");
reject("Group is NOT in the OU we want to synchronize to Office 365");
}
}
}


Administrators can test the script filtering by configuring Office 365 provisioning for "Preview Mode" (optional) and performing a manual sync. After provisioning is complete and a report is generated, administrators can review the
report for events that contain
ProvisioningScript as displayed in the below example for excluding users and groups that are not in the OU OUname:

User:
ProvisioningScript: DisplayName=newuser
ProvisioningScript: source.dn=cn=newuser,ou=mac,dc=domain,dc=com
ProvisioningScript: User is NOT in the OU we want to synchronize to Office 365
ProvisioningScript: Provisioning script object was rejected. Reason: User is NOT in the OU we want to synchronize to Office 365
SyncUserInternal: newuser@domain.com is user record sync rejected: User is NOT in the OU we want to synchronize to Office 365
Not syncing newuser@domain.com due to: User is NOT in the OU we want to synchronize to Office 365

Group:
ProvisioningScript: DisplayName=null
ProvisioningScript: source.dn=cn=grouptest,ou=mac,dc=domain,dc=com
ProvisioningScript: Group is NOT in the OU we want to synchronize to Office 365
ProvisioningScript: Provisioning script object was rejected. Reason: Group is NOT in the OU we want to synchronize to Office 365

 

Note: if restriction based on the domain is needed instead, please see following KB article:
KB-6839: Configuring Office 365 to exclude AD groups from synchronizing based on the domain name




Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA1hj0000001YECCA2&lang=en_US&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail