Edit

Share via


workflow: previewWorkflow

Namespace: microsoft.graph.identityGovernance

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Run a workflow in preview mode for selected directory objects without affecting production users. This action triggers workflow processing in preview mode, and results can be retrieved using the List userProcessingResults operation with $filter=workflowExecutionType eq 'previewMode'.

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) LifecycleWorkflows-Workflow.ReadWrite.All LifecycleWorkflows.ReadWrite.All
Delegated (personal Microsoft account) Not supported. Not supported.
Application LifecycleWorkflows-Workflow.ReadWrite.All LifecycleWorkflows.ReadWrite.All

Important

In delegated scenarios with work or school accounts, the signed-in user must be assigned a supported Microsoft Entra role or a custom role with a supported role permission. Lifecycle Workflows Administrator is the least privileged role supported for this operation.

HTTP request

POST /identityGovernance/lifecycleWorkflows/workflows/{workflow-id}/previewWorkflow

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json. Required.

Request body

In the request body, supply a JSON representation of the parameters.

The following table shows the parameters that are required with this action.

Parameter Type Description
subjects directoryObject collection A collection of directory objects (typically users) to include in the preview run. Maximum of 10 subjects per request. Required.

Response

If successful, this action returns a 204 No Content response code.

To retrieve the results of the preview run, use the List userProcessingResults operation with $filter=workflowExecutionType eq 'previewMode'. Results may not be immediately available; timing depends on workflow complexity. Results may include users from previous preview runs for the same workflow.

Examples

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/identityGovernance/lifecycleWorkflows/workflows/14879e66-9ea9-48d0-804d-8fea672d0341/previewWorkflow
Content-Type: application/json

{
  "subjects": [
    {
      "@odata.type": "#microsoft.graph.user",
      "id": "b59552b8-fa7b-4f68-8496-0a529aace8c0"
    },
    {
      "@odata.type": "#microsoft.graph.user",
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
    }
  ]
}

Response

The following example shows the response.

HTTP/1.1 204 No Content