Skip to main content

Trigger a Workflow when a User Account is Changed in Microsoft Entra ID

Updated over a month ago

You can trigger a Torq workflow when a user account is created, updated, or deleted in Microsoft Entra ID.

In the following example, the workflow uses delta queries in Microsoft Graph to retrieve details about changes to the user resource. The Get Latest Delta Token Query step queries the API endpoint for the user resource: https://graph.microsoft.com/v1.0/users/delta?$deltatoken=latest. A global variable is created from the output of that step, which is then returned by the Get Latest Delta for Users Resource step to obtain the URL for the specific API endpoint.

Prerequisites

Before you begin:

Create a subscription to Microsoft Graph API change notifications for the user resource

  1. Import the Microsoft Graph Subscription workflow: Import the Create Microsoft Graph Subscription and Renew Daily workflow template to your workspace.

  2. Configure the workflow parameters: Once the workflow opens, click the Workflow Parameters step.

    1. For torq_graph_microsoft365_webhook, paste the webhook URL you copied earlier when creating the Microsoft 365 Graph Subscription trigger integration.

    2. For microsoft365_integration, select the Microsoft 365 step integration instance you created earlier.

    3. For resource_to_monitor, enter /users.

    4. For Torq Integration, select the relevant Torq step integration instance.

    5. (Optional) Modify Torq Global Variable Name according to your organization's needs or customs.

  3. Edit both Create Graph Subscription to Change Notifications steps: For the Change type parameter, select create,updated,deleted to receive notifications for any changes to the user resource in Entra ID.

Create a workflow triggered by Microsoft 365 Graph API change notifications for the user resource

Change notifications for the user resource in Microsoft Graph can take several minutes to get delivered to the remote endpoint, i.e. the Torq trigger integration.

Microsoft Graph's change notifications only provide information about the nature of the change ("changeType": "created", "changeType": "updated", or "changeType": "deleted") and the affected user ID (resourceData.id) but won't provide further details about the specific change to the resource. Retrieving those details requires querying the appropriate endpoint from the Microsoft Graph API.

  1. Download the workflow: Download the Entra ID user account change notifications workflow below.

  2. Import the workflow: Navigate to Build > Workflows, click Import workflow, and select the workflow from your device.

  3. Configure the trigger: Open the trigger, click Create Trigger > Microsoft 365 Graph Subscription, and then select the integration instance you created earlier.

  4. Review and run the workflow: Review the workflow's steps and their parameters, and then run the workflow.

Workflow

Did this answer your question?