Using the initialization script
When running a workflow instance, Active Roles uses a single PowerShell operating environment, referred to as a runspace, for all script activities held in that workflow. The workflow runtime engine creates a runspace once the workflow instance has been started, and maintains the runspace during the initalization of the workflow instance.
When you configure a workflow, you can specify PowerShell commands you want the workflow runtime engine to run immediately after the runspace creation. These commands constitute the initialization script that the workflow engine runs prior to performing script activities.
With an initialization script, you can define runspace configuration data separately from the logic of the script activities and use it to initialize the environment for executing script activities. Specifically, you can:
-
Load PowerShell modules and snap-ins: All activity scripts can use the modules and snap-ins loaded in the initialization script, without having to load the prerequisite modules or snap-ins on a per-activity basis.
The modules and snap-ins loaded in the initialization script are available to all script activities at workflow runtime. For example, the Import-Module 'SmbShare' command added to the initialization script makes the Server Message Block (SMB) Share-specific cmdlets available to all script activities within the workflow.
-
Initialize environment-specific variables, referred to as global variables: All activity script can retrieve and update global variables, which makes it possible to exchange data between different activity scripts.
The global variables are visible to all script activities at workflow run time. For example, the $rGuid = [Guid]::NewGuid() command added to the initialization script makes the $rGuid variable available to all script activities within the workflow. To reference a variable that is defined in the initialization script, the activity script must use the $global: qualifier, such as $global:rGuid.
When the execution of the workflow instance is suspended (for example, waiting for approval), and then resumed (for example, after receiving an approval decision), the runspace is reinitialized so the global variables may change. If you need to preserve the value of a global variable, add the [Persist()] attribute to the variable's name in the initialization script, such as [Persist()]$rGuid = [Guid]::NewGuid(). The global variables defined in this way are saved to a persistent storage upon suspending the workflow instance and restored from the storage when the workflow instance is resumed. To save a variable, Active Roles creates and stores an XML-based representation of the object signified by that variable, similarly to the Export-Clixml command in Windows PowerShell. When restoring the variable, Active Roles retrieves the XML data that represents the object, and creates the object based on that data, similarly to the Import-Clixml command.
To view or change the initialization script
-
In the Active Roles Console tree, expand Configuration > Policies > Workflow, and select the workflow you want to configure.
This opens the Workflow Designer in the Details pane, representing the workflow definition as a process diagram.
-
In the Details pane, click Workflow options and start conditions to expand the area above the process diagram, and then click Configure.
-
Click the Initialization script tab in the dialog that opens.
The Initialization script tab displays the current script. You can add or modify the script by typing in the edit box on that tab.
Approval workflow
Approval workflows complement automated policies, to make provisioning and deprovisioning decisions based on human input. While automated policies require no manual intervention, approval-based fulfillment of administrative operations adds to process automation the ability to manually accept or deny operation requests, and to monitor the execution of request-processing tasks to ensure they are responded in a timely manner.
An Approval workflow can service a range of requests, which are user actions intended to perform administrative operations. Examples of such operations include the creation, modification, and deprovisioning of user accounts.
When a requested operation requires permission from certain individuals in an organization, a workflow can be started to coordinate the approval process. The system only performs the requested operation after approval is given by an authorized person.
Active Roles administrators can create and configure Approval workflows by using the Workflow Designer: a graphical tool provided in the Active Roles Console for constructing workflows. When designing an Approval workflow, the administrator specifies the kind of operations that start the workflow, and also adds Approval rules to the workflow. The Approval rules determine who is authorized to approve the operation, the required sequence of approvals, and who needs to be notified of approval tasks or decisions.
The Approval workflow solution provided by Active Roles includes:
-
The Workflow Designer for constructing workflows, available from the Active Roles Console. Use the Workflow Designer to configure an Approval workflow by adding approval activities to the workflow definition.
-
The directory management interfaces, such as the Web Interface or Active Roles Console for submitting operation requests for approval. For example, you can configure an Approval workflow so that when creating a user account via Active Roles, the user is only created if the action is approved beforehand.
-
The approval-related section of the Web Interface to manage operation requests. This section provides a “to-do” list of the approval tasks a designated user has to carry out, allowing the user to perform tasks such as approving or rejecting operation requests.
Definition of terms – Approval workflow
This section summarizes some important definitions that apply to approval workflow.
Approval
A decision point in a workflow that is used to obtain authorization from a person before continuing the workflow.
Approval rule (Approval activity)
Workflow activities of the Approval category are referred to as approval rules. Workflow start conditions determine which operations start the workflow and the approval rules added to the workflow determine who is authorized to approve the operation, the required sequence of approvals, and who needs to be notified of approval tasks or decisions.
Approval task
A task created as part of the processing of an approval rule and assigned to an approver. The approver is expected to complete the task by making a decision to allow or deny the operation.
Approver
The person designated to perform an approval task. The setting that determines the approvers is a configuration element of an approval rule. When processing an approval rule, Active Roles creates an approval task and assigns it to the approvers defined by the rule. The state of the task governs the workflow transition: the task must receive the “Approve” resolution for the operation to pass through the approval rule. If the task has received the “Reject” resolution, the operation is denied and the workflow instance is completed.
Initiator (requestor)
The identity of the user or service that has requested an operation in Active Roles. For example, when the Active Roles Console is used to change or create an object, the Console user is identified as the initiator of the respective operation. The initiator of an operation is also referred to as the operation requestor.
Notification
The means used to notify a user or group of users about a specific predefined situation that could manifest within a workflow. A notification message is generated and sent to the designated recipients via email to inform them that a certain event has occurred, such as a new approval task has been submitted to the approvers or the operation has been completed. A notification configuration, stored as part of an approval rule, involves such elements as the event to notify of, the list of the notification recipients and the notification message template. Active Roles also provides a separate category of workflow activity for the purpose of notification, in addition to approval rules.
Operation
A request for certain changes to be made to directory data, such as creating users or adding users to groups. An operation can start an approval workflow, in which case the requested changes are made only after they are approved.
Operation target object
The object to be changed or created by the operation. For example, if creation of a user account is requested, that account is referred to as the operation target object. With a request to add a user to a group, the group is referred to as the operation target object.
How the Approval workflow works
An Approval workflow is governed by workflow start conditions and approval rules. Workflow start conditions determine which kind of operation causes the workflow to start, and the approval rules added to the workflow determine the persons who are authorized to approve the operation (approvers).
When an Active Roles user requests an operation, Active Roles checks to see whether the operation meets the start conditions of any workflow, and starts the workflow whose conditions are met. An Approval rule included in the workflow then generates an approval task and assigns the task to the approvers defined by the rule.
An approver completes an approval task by applying the Approve or Reject action to the task. This changes the status of the task from Pending to Approved, or Rejected respectively.