Script execution policies help you run supplementary PowerShell (or other) script modules in Active Roles during or after performing certain administrative operations. When linking a custom script to an administrative operation via a Script Execution policy, the script will receive control in Active Roles either when the operation is requested or when it is completed.
Use Script Execution policies to set up custom scripts (residing in Script Modules in the Active Roles Console) to:
-
Trigger additional actions when performing directory object provisioning.
-
Regulate object data format and requirements (such as for generating user passwords).
-
Further automate administrative tasks.
Example use case for a Script Execution policy
Consider a scenario where employees of an organization are frequently transferred among its office branches temporarily due to various projects.
To administer such temporary assignments quickly and efficiently, write and apply a custom script that automatically reassigns the employee's user account from the OU of their original office to the OU of their new office, whenever their City or Office Location attributes are updated in Active Roles.
For more information on how to set up a Script Execution policy, see Configuring a Script Execution policy.
TIP: Consider the following when planning to use custom scripts for your provisioning policies:
-
To help you configure Script Execution policies, Active Roles also ships with several built-in Script Modules that you can use to set up your own Script Execution policies. Find these built-in Script Modules in the following node of the Active Roles Console:
Configuration > Script Modules > Builtin
-
If the directory of your organization contains any cloud-only Azure users, then use the built-in Generate User Password - Azure only script module to set up a password generation policy for cloud-only Azure users that meets the password strength criteria of both your organization and Microsoft Azure Active Directory (Azure AD).
NOTE: Policy Object settings specific to Azure cloud-only objects (such as cloud-only Azure users, guest users, or contacts) are available only if your Active Roles deployment is licensed for managing cloud-only Azure objects. Contact One Identity support for more information.
Also, Policy Objects specific to Azure cloud-only objects will work correctly only if an Azure tenant is already configured in the AD of the organization, and Active Roles is already set as a consented Azure application for that Azure tenant. For more information on these settings, see Configuring a new Azure tenant and consenting Active Roles as an Azure application.
Active Roles executes the script module specified in the policy when the operation is requested or after the operation is completed. The script module is stored in the Active Roles configuration database.
When configuring a Script Execution policy, you can prepare a script module beforehand. Alternatively, you can create an empty script module when configuring a policy, and later you can edit the module and add a script to be used by the policy.
To configure a Script Execution policy
-
On the Policy to Configure page, select Script Execution, then click Next.
-
On the Script Module page, do one of the following:
-
To use an existing script module, click Select a script module, and select the script module in the box beneath this option.
-
To create new script module, click Create a new script module, and click Next. Then, specify a name for the script module, and click Next. Then, select the event handlers you want the script module to include.
-
Click Next.
-
On the Policy Parameters page, do the following:
-
(Optional) If necessary, from the Function to declare parameters list, choose the function that defines the parameters specific to this policy.
The list contains the names of all script functions found in the selected Script Module. The policy has the parameters that are defined by the function specified in the Function to declare parameters box. Normally, this is a function named onInit.
-
Under Parameter values, view or change the values of the policy parameters. To change the value of a parameter, select the name of the parameter and click Edit.
Clicking Edit displays a page where you can add, remove, or select a value or values for the selected parameter. For each parameter, the function that is used to declare parameters defines the name of the parameter and other characteristics, such as a description, a list of possible values, the default value, and whether a value is required. If a list of possible values is defined, then you can only select values from that list.
-
On the Enforce Policy page, you can specify objects to which this Policy Object will be applied. To do so, click Add, and use the Select Objects dialog to locate and select the objects you want.
-
Click Next, then click Finish.
To create a script module
-
In the Console tree, under Configuration > Script Modules, locate and select the folder in which you want to add the script module.
To create a new folder, right-click Script Modules and select New > Scripts Container. Similarly, you can create a sub-folder in a folder by right-clicking the folder and selecting New > Scripts Container.
-
Right-click the folder and select New > Script Module.
-
Specify the name and language of the module to create. Then, click Next.
-
In Select a script module type, click the type of the module to create. Then, click Next.
-
If you selected the Policy script type for the module, select the event handlers you want the module to include, then click Next.
-
Click Finish.
To edit a script module
-
In the Console tree, expand Configuration > Script Modules.
-
Under Script Modules, click the folder that contains the script module you want to edit.
-
In the details pane, right-click the script module, then click Edit Script.
-
Use the details pane to make changes to the script.
-
Right-click the script module in the Console tree, and do one of the following:
-
To commit the changes you have made, click Save Script on Server.
-
To quit the script editor without saving your changes, click Discard Changes.
To import a script module
-
In the Console tree, under Configuration > Script Modules, locate and select the folder in which you want to add the script module.
To create a new folder, right-click Script Modules and select New > Scripts Container. Similarly, you can create a sub-folder in a folder by right-clicking the folder and selecting New > Scripts Container.
-
Right-click the folder, and click Import.
-
Locate and select the file containing the script to import, and click Open.
To export a script module
-
In the Console tree, expand Configuration > Script Modules.
-
Under Script Modules, select the folder that contains the script module you want to export.
-
In the details pane, right-click the script module, and select All Tasks > Export.
-
Specify the file to which you want to save the script, then click Save.
To import a script file, in the Console tree, right-click Script Modules, and click Import. This displays the Import Script dialog where you can select and open a script file.