ワークフローを作成する

名前空間: microsoft.graph.identityGovernance

重要

Microsoft Graph の /beta バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。

新しい ワークフロー オブジェクトを作成します。 テナントには最大 100 個のワークフローを作成できます。

この API は、次の国内クラウド展開で使用できます。

グローバル サービス 米国政府機関 L4 米国政府機関 L5 (DOD) 21Vianet が運営する中国
✅ ✅ ✅ ✅

アクセス許可

この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。 アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。

アクセス許可の種類 最小特権アクセス許可 より高い特権のアクセス許可
委任 (職場または学校のアカウント) LifecycleWorkflows-Workflow.ReadWrite.All LifecycleWorkflows.ReadWrite.All
委任 (個人用 Microsoft アカウント) サポートされていません。 サポートされていません。
アプリケーション LifecycleWorkflows-Workflow.ReadWrite.All LifecycleWorkflows.ReadWrite.All

重要

職場または学校アカウントを使用してアクセスを委任するには、サインインしたユーザーに、サポートされている Microsoft Entra ロール、またはこの操作に必要なアクセス許可を付与するカスタム ロールが割り当てられている必要があります。 ライフサイクル ワークフロー管理者 は、この操作でサポートされる最小特権ロールです。

HTTP 要求

POST /identityGovernance/lifecycleWorkflows/workflows

要求ヘッダー

名前 説明
Authorization ベアラー {token}。 必須です。 認証と認可についての詳細をご覧ください。
Content-Type application/json. 必須です。

要求本文

リクエストの本文には、 ワークフロー オブジェクトの JSON 表現を指定します。

ワークフローの作成時に、次のプロパティを指定できます。

プロパティ 型 説明
category microsoft.graph.identityGovernance.lifecycleWorkflowCategory ワークフローのカテゴリ。 使用可能な値: joiner、leaver、unknownFutureValue。 値は 1 つだけ指定できます。 必須です。
説明 String 管理用ワークフローの目的を説明する文字列。
displayName 文字列 ワークフローを識別する一意の文字列。 必須です。
executionConditions microsoft.graph.identityGovernance.workflowExecutionConditions ワークフローが実行されるユーザーとタイミングを定義します。 必須。
id 文字列 特定のワークフローに個別に対処するために使用される識別子。
isEnabled ブール値 ワークフローが実行するように設定されているかどうかを示すブール値。
isSchedulingEnabled ブール型 スケジュールが有効になっているかどうかを示すブール値。
tasks microsoft.graph.identityGovernance.task コレクション 実行するように構成されたタスクと、ワークフロー内での実行シーケンスを表します。 必須です。

応答

成功した場合、このメソッドは応答本文で 201 Created 応答コードと microsoft.graph.identityGovernance.workflow オブジェクトを返します。

例

例 1:時間ベースのトリガーを使用して結合子ワークフローを作成する

要求

次の例は、次の構成でワークフローを作成する要求を示しています:

  • これは "結合子" ワークフローが有効であり、実行するようにスケジュールされています。
  • これは、時間ベースの属性トリガーを使用して、オーストラリアに拠点を置く新しいユーザーの employeeHireDate で実行されます。
  • ワークフローの実行時には、ユーザーのアカウントが有効になっていることと、ユーザーに "ようこそ" メールが送信されるという 2 つのタスクが実行されます。
POST https://graph.microsoft.com/beta/identityGovernance/lifecycleWorkflows/workflows
Content-Type: application/json

{
    "category": "joiner",
    "description": "Configure new hire tasks for onboarding employees on their first day",
    "displayName": "Australia Onboard new hire employee",
    "isEnabled": true,
    "isSchedulingEnabled": true,
    "executionConditions": {
        "@odata.type": "#microsoft.graph.identityGovernance.triggerAndScopeBasedConditions",
        "scope": {
            "@odata.type": "#microsoft.graph.identityGovernance.ruleBasedSubjectSet",
            "rule": "(country eq 'Australia')"
        },
        "trigger": {
            "@odata.type": "#microsoft.graph.identityGovernance.timeBasedAttributeTrigger",
            "timeBasedAttribute": "employeeHireDate",
            "offsetInDays": 0
        }
    },
    "tasks": [
        {
            "continueOnError": false,
            "description": "Enable user account in the directory",
            "displayName": "Enable User Account",
            "isEnabled": true,
            "taskDefinitionId": "6fc52c9d-398b-4305-9763-15f42c1676fc",
            "arguments": []
        },
        {
            "continueOnError": false,
            "description": "Send welcome email to new hire",
            "displayName": "Send Welcome Email",
            "isEnabled": true,
            "taskDefinitionId": "70b29d51-b59a-4773-9280-8841dfd3f2ea",
            "arguments": []
        }
    ]
}

応答

次の例は応答を示しています。

注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。

HTTP/1.1 201 Created
Content-Type: application/json

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#identityGovernance/lifecycleWorkflows/workflows/$entity",
    "category": "joiner",
    "description": "Configure new hire tasks for onboarding employees on their first day",
    "displayName": "New Zealand new hire",
    "lastModifiedDateTime": "2022-08-26T04:51:27.521792Z",
    "createdDateTime": "2022-08-26T04:51:27.5217824Z",
    "deletedDateTime": null,
    "id": "818cd47f-138c-4a83-b3f5-afa92bfcf391",
    "isEnabled": true,
    "isSchedulingEnabled": false,
    "nextScheduleRunDateTime": null,
    "version": 1,
    "executionConditions": {
        "@odata.type": "#microsoft.graph.identityGovernance.triggerAndScopeBasedConditions",
        "scope": {
            "@odata.type": "#microsoft.graph.identityGovernance.ruleBasedSubjectSet",
            "rule": "(country eq 'New Zealand')"
        },
        "trigger": {
            "@odata.type": "#microsoft.graph.identityGovernance.timeBasedAttributeTrigger",
            "timeBasedAttribute": "employeeHireDate",
            "offsetInDays": 0
        }
    }
}

例 2: 属性変更トリガーを使用してムーバー ワークフローを作成する

要求

次の例は、次の構成でワークフローを作成する要求を示しています:

  • これは "ムーバー" ワークフロー対応であり、実行するようにスケジュールされています。
  • 属性変更トリガーを使用して "営業" 部門に追加された既存のユーザーに対して実行されます。
  • ユーザーのマネージャーに移動を通知する電子メールを送信するという 1 つのタスクが実行されます。
POST https://graph.microsoft.com/beta/identityGovernance/lifecycleWorkflows/workflows
Content-Type: application/json
Content-length: 631

{
    "category": "mover",
    "description": "Configure mover tasks for a user when their job profile changes",
    "displayName": "Sales contractor moves to full-time employee",
    "isEnabled": true,
    "isSchedulingEnabled": true,
    "executionConditions": {
        "@odata.type": "#microsoft.graph.identityGovernance.triggerAndScopeBasedConditions",
        "scope": {
            "@odata.type": "#microsoft.graph.identityGovernance.ruleBasedSubjectSet",
            "rule": "(department eq 'Sales')"
        },
        "trigger": {
            "@odata.type": "#microsoft.graph.identityGovernance.attributeChangeTrigger",
            "triggerAttributes": [
                {
                    "name": "department"
                }
            ]
        }
    },
    "tasks": [
        {
            "continueOnError": false,
            "description": "Send email to moving employee's manager",
            "displayName": "Notify manager of move",
            "isEnabled": true,
            "taskDefinitionId": "aab41899-9972-422a-9d97-f626014578b7",
            "arguments": []
        }
    ]
}

応答

次の例は応答を示しています。

注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。

HTTP/1.1 200 OK
Content-Type: application/json

{
    "category": "mover",
    "description": "Configure mover tasks for a user when their job profile changes",
    "displayName": "Sales contractor moves to full time employee",
    "isEnabled": true,
    "isSchedulingEnabled": true,
    "executionConditions": {
        "@odata.type": "#microsoft.graph.identityGovernance.triggerAndScopeBasedConditions",
        "scope": {
            "@odata.type": "#microsoft.graph.identityGovernance.ruleBasedSubjectSet",
            "rule": "(department eq 'Sales')"
        },
        "trigger": {
            "@odata.type": "#microsoft.graph.identityGovernance.attributeChangeTrigger",
            "triggerAttributes": [
                {
                    "name": "department"
                }
            ]
        }
    },
    "tasks": [
        {
            "continueOnError": false,
            "description": "Send email to moving employee's manager",
            "displayName": "Notify manager of move",
            "isEnabled": true,
            "taskDefinitionId": "aab41899-9972-422a-9d97-f626014578b7",
            "arguments": []
        }
    ]
}

例 3:グループ ベースのトリガーを使用して離脱ワークフローを作成する

要求

次の例は、次の構成でワークフローを作成する要求を示しています:

  • これは "脱退" ワークフローが有効になっており、実行するようにスケジュールされています。
  • これは、グループ ベースのトリガーを使用して Sales グループから削除されたユーザーに対して実行されます。
  • ワークフローの実行時には、[すべてのチームからユーザーを削除する]、[すべてのグループからユーザーを削除する] という 2 つのタスクが実行されます。
POST https://graph.microsoft.com/beta/identityGovernance/lifecycleWorkflows/workflows
Content-Type: application/json

{
    "category": "leaver",
    "description": "Configure offboarding tasks for employees on their last day of work",
    "displayName": "Offboard an employee",
    "isEnabled": true,
    "isSchedulingEnabled": true,
    "executionConditions": {
        "@odata.type": "#microsoft.graph.identityGovernance.triggerAndScopeBasedConditions",
        "scope": {
            "@odata.type": "#microsoft.graph.identityGovernance.groupBasedSubjectSet",
            "groups": [
                {
                    "id": "668e7540-7f8e-4ca4-a207-b7dffbb6d038"
                }
            ]
        },
        "trigger": {
            "@odata.type": "#microsoft.graph.identityGovernance.membershipChangeTrigger",
            "changeType": "remove"
        }
    },
    "tasks": [
        {
            "category": "leaver",
            "continueOnError": false,
            "description": "Remove user from all Teams memberships",
            "displayName": "Remove user from all Teams",
            "isEnabled": true,
            "taskDefinitionId": "81f7b200-2816-4b3b-8c5d-dc556f07b024",
            "arguments": []
        },
        {
            "category": "leaver",
            "continueOnError": false,
            "description": "Remove user from all Azure AD groups memberships",
            "displayName": "Remove user from all groups",
            "isEnabled": true,
            "taskDefinitionId": "b3a31406-2a15-4c9a-b25b-a658fa5f07fc",
            "arguments": []
        }
    ]
}

応答

次の例は応答を示しています。

注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。

HTTP/1.1 201 Created
Content-Type: application/json

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#identityGovernance/lifecycleWorkflows/workflows/$entity",
    "category": "leaver",
    "description": "Configure offboarding tasks for employees on their last day of work",
    "displayName": "Offboard an employee",
    "isEnabled": true,
    "isSchedulingEnabled": true,
    "lastModifiedDateTime": "2024-03-28T20:20:05.6599449Z",
    "createdDateTime": "2024-03-28T20:20:05.6599142Z",
    "deletedDateTime": null,
    "id": "73ed8912-6a04-4f5d-bef8-61fcc94336a7",
    "nextScheduleRunDateTime": "2024-03-28T20:37:08Z",
    "version": 1,
    "executionConditions": {
        "@odata.type": "#microsoft.graph.identityGovernance.triggerAndScopeBasedConditions",
        "scope": {
            "@odata.type": "#microsoft.graph.identityGovernance.groupBasedSubjectSet"
        },
        "trigger": {
            "@odata.type": "#microsoft.graph.identityGovernance.membershipChangeTrigger",
            "changeType": "remove"
        }
    }
}

例 4: 設定されたターゲット スコープでムーバー ワークフローを作成する

要求

次の例は、次の構成でワークフローを作成する要求を示しています:

  • これは "ムーバー" ワークフロー対応であり、オンデマンドでのみ実行されるように設定されます。
  • これは、管理単位 "4f9dc456-0574-4122-9e55-8b4cc494b27d" および "2c987843-e9b1-4b1a-b924-ff1d2a9b054d" に設定された対象範囲内のユーザーに対して実行されます。
  • ユーザーのマネージャーに移動を通知する電子メールを送信するという 1 つのタスクが実行されます。
POST https://graph.microsoft.com/beta/identityGovernance/lifecycleWorkflows/workflows

{
  "category": "mover",
  "displayName": "On Demand workflow move",
  "description": "Execute real-time tasks for employee job changes",
  "tasks": [
    {
      "arguments": [],
      "description": "Send email to notify user’s manager of user move",
      "displayName": "Send email to notify manager of user move",
      "isEnabled": true,
      "continueOnError": false,
      "taskDefinitionId": "aab41899-9972-422a-9d97-f626014578b7",
      "category": "mover"
    }
  ],
  "executionConditions": {
    "@odata.type": "#microsoft.graph.identityGovernance.onDemandExecutionOnly"
  },
  "isEnabled": true,
  "isSchedulingEnabled": false,
  "administrationScopeTargets": [
    {
      "@odata.type": "#microsoft.graph.administrativeUnit",
      "id": "4f9dc456-0574-4122-9e55-8b4cc494b27d"
    },
    {
      "@odata.type": "#microsoft.graph.administrativeUnit",
      "id": "2c987843-e9b1-4b1a-b924-ff1d2a9b054d"
    }
  ]
}

応答

次の例は応答を示しています。

注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。

HTTP/1.1 201 Created
Content-Type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#identityGovernance/lifecycleWorkflows/workflows/$entity",
  "category": "mover",
  "description": "Execute real-time tasks for employee job changes",
  "displayName": "On Demand workflow move",
  "isEnabled": true,
  "isSchedulingEnabled": false,
  "lastModifiedDateTime": "2025-01-09T15:28:24.0565594Z",
  "createdDateTime": "2025-01-09T15:28:24.0565526Z",
  "id": "465d0d08-3099-483f-9d93-16aad77bcd22",
  "version": 1,
  "administrationScopeTargets": [
    {
      "@odata.type": "#microsoft.graph.administrativeUnit",
      "id": "4f9dc456-0574-4122-9e55-8b4cc494b27d"
    },
    {
      "@odata.type": "#microsoft.graph.administrativeUnit",
      "id": "2c987843-e9b1-4b1a-b924-ff1d2a9b054d"
    }
  ]
}

例 5:採用日の 7 日前に実行するワークフローを作成する

要求

次の例では、ユーザーの採用日のちょうど 7 日前に実行されるワークフローを作成します。

POST https://graph.microsoft.com/beta/identityGovernance/lifecycleWorkflows/workflows
Content-Type: application/json

{
  "displayName": "Pre-hire onboarding: 7 days before hire",
  "isEnabled": true,
  "isSchedulingEnabled": true,
  "executionConditions": {
    "@odata.type": "#microsoft.graph.identityGovernance.triggerAndScopeBasedConditions",
    "scope": {
      "@odata.type": "#microsoft.graph.identityGovernance.ruleBasedSubjectSet",
      "rule": "(department eq 'Engineering')"
    },
    "trigger": {
      "@odata.type": "#microsoft.graph.identityGovernance.timeBasedAttributeTriggerV2",
      "attribute": "employeeHireDate",
      "operator": {
        "@odata.type": "#microsoft.graph.identityGovernance.operatorEqualTo",
        "eventTiming": "before",
        "offsetInDays": 7
      }
    }
  },
  "tasks": [
    {
      "isEnabled": true,
      "taskDefinitionId": "1b555e50-7f65-41d5-b514-5894a026d10d",
      "displayName": "Generate TAP And Send Email"
    }
  ]
}

応答

次の例は応答を示しています。

HTTP/1.1 201 Created
Content-Type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#identityGovernance/lifecycleWorkflows/workflows/$entity",
  "id": "c35e0d2a-8725-4aa1-b132-6b21a80635b5",
  "displayName": "Pre-hire onboarding: 7 days before hire",
  "isEnabled": true,
  "isSchedulingEnabled": true,
  "version": 1
}

例 6:休暇日から 60 日以内にユーザーのワークフローを作成する

要求

次の例では、休暇日が 60 日前以下であるユーザーをスコープで囲むワークフローを作成します。

POST https://graph.microsoft.com/beta/identityGovernance/lifecycleWorkflows/workflows
Content-Type: application/json

{
  "displayName": "Post-leave compliance: within 60 days after leave",
  "isEnabled": true,
  "isSchedulingEnabled": true,
  "executionConditions": {
    "@odata.type": "#microsoft.graph.identityGovernance.triggerAndScopeBasedConditions",
    "scope": {
      "@odata.type": "#microsoft.graph.identityGovernance.ruleBasedSubjectSet",
      "rule": "(department eq 'Finance')"
    },
    "trigger": {
      "@odata.type": "#microsoft.graph.identityGovernance.timeBasedAttributeTriggerV2",
      "attribute": "employeeLeaveDateTime",
      "operator": {
        "@odata.type": "#microsoft.graph.identityGovernance.operatorLessThanEqualTo",
        "eventTiming": "after",
        "offsetInDays": 60
      }
    }
  },
  "tasks": [
    {
      "isEnabled": true,
      "taskDefinitionId": "1b555e50-7f65-41d5-b514-5894a026d10d",
      "displayName": "Run Post-Leave Compliance Check"
    }
  ]
}

応答

次の例は応答を示しています。

HTTP/1.1 201 Created
Content-Type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#identityGovernance/lifecycleWorkflows/workflows/$entity",
  "id": "83d68cba-56c0-4412-8bf7-1af2befc1333",
  "displayName": "Post-leave compliance: within 60 days after leave",
  "isEnabled": true,
  "isSchedulingEnabled": true,
  "version": 1
}

例 7:7 日から 30 日前までの間に雇用されたユーザーのワークフローを作成する

要求

次の例では、採用されてから 7 日を超えて 30 日未満のユーザーをスコープで囲むワークフローを作成します。

POST https://graph.microsoft.com/beta/identityGovernance/lifecycleWorkflows/workflows
Content-Type: application/json

{
  "displayName": "Post-hire check-in: 7 to 30 days after hire",
  "isEnabled": true,
  "isSchedulingEnabled": true,
  "executionConditions": {
    "@odata.type": "#microsoft.graph.identityGovernance.triggerAndScopeBasedConditions",
    "scope": {
      "@odata.type": "#microsoft.graph.identityGovernance.ruleBasedSubjectSet",
      "rule": "(department eq 'Engineering')"
    },
    "trigger": {
      "@odata.type": "#microsoft.graph.identityGovernance.timeBasedAttributeTriggerV2",
      "attribute": "employeeHireDate",
      "operator": {
        "@odata.type": "#microsoft.graph.identityGovernance.operatorBetween",
        "eventTiming": "after",
        "greaterThanOffsetInDays": 7,
        "lessThanOffsetInDays": 30
      }
    }
  },
  "tasks": [
    {
      "isEnabled": true,
      "taskDefinitionId": "1b555e50-7f65-41d5-b514-5894a026d10d",
      "displayName": "Send Onboarding Check-in Survey"
    }
  ]
}

応答

次の例は応答を示しています。

HTTP/1.1 201 Created
Content-Type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#identityGovernance/lifecycleWorkflows/workflows/$entity",
  "id": "445ffc46-3ccc-4e1a-bac9-aef675ee8d18",
  "displayName": "Post-hire check-in: 7 to 30 days after hire",
  "isEnabled": true,
  "isSchedulingEnabled": true,
  "version": 1
}

例 8: 休暇日の 3 日前から 14 日前のユーザーのワークフローを作成する

要求

次の例では、休暇日が 3 日を超えて 14 日未満のユーザーをスコープで囲むワークフローを作成します。

POST https://graph.microsoft.com/beta/identityGovernance/lifecycleWorkflows/workflows
Content-Type: application/json

{
  "displayName": "Pre-leave prep: 3 to 14 days before leave",
  "isEnabled": true,
  "isSchedulingEnabled": true,
  "executionConditions": {
    "@odata.type": "#microsoft.graph.identityGovernance.triggerAndScopeBasedConditions",
    "scope": {
      "@odata.type": "#microsoft.graph.identityGovernance.ruleBasedSubjectSet",
      "rule": "(department eq 'Engineering')"
    },
    "trigger": {
      "@odata.type": "#microsoft.graph.identityGovernance.timeBasedAttributeTriggerV2",
      "attribute": "employeeLeaveDateTime",
      "operator": {
        "@odata.type": "#microsoft.graph.identityGovernance.operatorBetween",
        "eventTiming": "before",
        "greaterThanOffsetInDays": 3,
        "lessThanOffsetInDays": 14
      }
    }
  },
  "tasks": [
    {
      "isEnabled": true,
      "taskDefinitionId": "1b555e50-7f65-41d5-b514-5894a026d10d",
      "displayName": "Transfer Ownership of Shared Resources"
    }
  ]
}

応答

次の例は応答を示しています。

HTTP/1.1 201 Created
Content-Type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#identityGovernance/lifecycleWorkflows/workflows/$entity",
  "id": "6bc1a524-6df8-4cfd-ac6d-caf9f88b3702",
  "displayName": "Pre-leave prep: 3 to 14 days before leave",
  "isEnabled": true,
  "isSchedulingEnabled": true,
  "version": 1
}

例 9:採用日に実行するワークフローを作成する

要求

次の例では、ユーザーの採用日に実行されるワークフローを作成します。 offsetInDays が0の場合は、eventTiming を on に設定する必要があります。

POST https://graph.microsoft.com/beta/identityGovernance/lifecycleWorkflows/workflows
Content-Type: application/json

{
  "displayName": "Day-of-hire: enable account and grant access",
  "isEnabled": true,
  "isSchedulingEnabled": true,
  "executionConditions": {
    "@odata.type": "#microsoft.graph.identityGovernance.triggerAndScopeBasedConditions",
    "scope": {
      "@odata.type": "#microsoft.graph.identityGovernance.ruleBasedSubjectSet",
      "rule": "(department eq 'Engineering')"
    },
    "trigger": {
      "@odata.type": "#microsoft.graph.identityGovernance.timeBasedAttributeTriggerV2",
      "attribute": "employeeHireDate",
      "operator": {
        "@odata.type": "#microsoft.graph.identityGovernance.operatorEqualTo",
        "eventTiming": "on",
        "offsetInDays": 0
      }
    }
  },
  "tasks": [
    {
      "isEnabled": true,
      "taskDefinitionId": "6fc52c9d-398b-4571-8c4c-57c8ea85daac",
      "displayName": "Enable User Account"
    }
  ]
}

応答

次の例は応答を示しています。

HTTP/1.1 201 Created
Content-Type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#identityGovernance/lifecycleWorkflows/workflows/$entity",
  "id": "275fb885-528a-46f1-b5cf-cfdfb7069824",
  "displayName": "Day-of-hire: enable account and grant access",
  "isEnabled": true,
  "isSchedulingEnabled": true,
  "version": 1
}

例 10:休暇日の 30 日後に実行するワークフローを作成する

要求

次の例では、ユーザーの退職日から正確に 30 日後に実行されるワークフローを作成します。

POST https://graph.microsoft.com/beta/identityGovernance/lifecycleWorkflows/workflows
Content-Type: application/json

{
  "displayName": "Post-leave cleanup: 30 days after leave",
  "isEnabled": true,
  "isSchedulingEnabled": true,
  "executionConditions": {
    "@odata.type": "#microsoft.graph.identityGovernance.triggerAndScopeBasedConditions",
    "scope": {
      "@odata.type": "#microsoft.graph.identityGovernance.ruleBasedSubjectSet",
      "rule": "(department eq 'Engineering')"
    },
    "trigger": {
      "@odata.type": "#microsoft.graph.identityGovernance.timeBasedAttributeTriggerV2",
      "attribute": "employeeLeaveDateTime",
      "operator": {
        "@odata.type": "#microsoft.graph.identityGovernance.operatorEqualTo",
        "eventTiming": "after",
        "offsetInDays": 30
      }
    }
  },
  "tasks": [
    {
      "isEnabled": true,
      "taskDefinitionId": "8d18588d-9ad3-4c0f-99d0-ec215f0e3dff",
      "displayName": "Delete User Account"
    }
  ]
}

応答

次の例は応答を示しています。

HTTP/1.1 201 Created
Content-Type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#identityGovernance/lifecycleWorkflows/workflows/$entity",
  "id": "83b77dc5-751d-4640-b628-69d949b09bac",
  "displayName": "Post-leave cleanup: 30 days after leave",
  "isEnabled": true,
  "isSchedulingEnabled": true,
  "version": 1
}

例 11:休暇日から 14 日以内にユーザーのワークフローを作成する

要求

次の例では、休暇日が今後 14 日以内のユーザーをスコープに入れるワークフローを作成します。

POST https://graph.microsoft.com/beta/identityGovernance/lifecycleWorkflows/workflows
Content-Type: application/json

{
  "displayName": "Pre-leave: within 14 days of leave",
  "isEnabled": true,
  "isSchedulingEnabled": true,
  "executionConditions": {
    "@odata.type": "#microsoft.graph.identityGovernance.triggerAndScopeBasedConditions",
    "scope": {
      "@odata.type": "#microsoft.graph.identityGovernance.ruleBasedSubjectSet",
      "rule": "(department eq 'Engineering')"
    },
    "trigger": {
      "@odata.type": "#microsoft.graph.identityGovernance.timeBasedAttributeTriggerV2",
      "attribute": "employeeLeaveDateTime",
      "operator": {
        "@odata.type": "#microsoft.graph.identityGovernance.operatorLessThanEqualTo",
        "eventTiming": "before",
        "offsetInDays": 14
      }
    }
  },
  "tasks": [
    {
      "isEnabled": true,
      "taskDefinitionId": "1b555e50-7f65-41d5-b514-5894a026d10d",
      "displayName": "Send Offboarding Reminder to Manager"
    }
  ]
}

応答

次の例は応答を示しています。

HTTP/1.1 201 Created
Content-Type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#identityGovernance/lifecycleWorkflows/workflows/$entity",
  "id": "b784cf0f-1b6e-4e04-bb24-d2af0261514d",
  "displayName": "Pre-leave: within 14 days of leave",
  "isEnabled": true,
  "isSchedulingEnabled": true,
  "version": 1
}