次の方法で共有


ワークフロー: createNewVersion

名前空間: microsoft.graph.identityGovernance

重要

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

ワークフロー オブジェクトの新しいバージョンを作成します。

この 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/{workflowId}/createNewVersion

要求ヘッダー

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

要求本文

要求本文で、パラメーターの JSON 表現を指定します。

次の表に、このアクションで使用できるパラメーターを示します。

パラメーター 説明
ワークフロー microsoft.graph.identityGovernance.workflow 新しいバージョンを作成するワークフロー。

応答

成功した場合、このアクションは 200 OK 応答コードと、応答本文に microsoft.graph.identityGovernance.workflow を返します。

例 1: 時間ベースのトリガーを使用して新しいバージョンの joiner ワークフローを作成する

要求

次の例は要求を示しています。

POST https://graph.microsoft.com/beta/identityGovernance/lifecycleWorkflows/workflows/{workflowId}/createNewVersion
Content-Type: application/json
Content-length: 631

{
    "workflow":{
        "category": "joiner",
        "description": "Configure new hire tasks for onboarding employees on their first day",
        "displayName": "Global onboard new hire employee",
        "isEnabled": true,
        "isSchedulingEnabled": false,
        "executionConditions": {
            "@odata.type": "#microsoft.graph.identityGovernance.triggerAndScopeBasedConditions",
            "scope": {
                "@odata.type": "#microsoft.graph.identityGovernance.ruleBasedSubjectSet",
                "rule": "(department eq 'Marketing')"
            },
            "trigger": {
                "@odata.type": "#microsoft.graph.identityGovernance.timeBasedAttributeTrigger",
                "timeBasedAttribute": "employeeHireDate",
                "offsetInDays": 1
            }
        },
        "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 200 OK
Content-Type: application/json


{
    "workflow":{
        "category": "joiner",
        "description": "Configure new hire tasks for onboarding employees on their first day",
        "displayName": "Global onboard new hire employee",
        "isEnabled": true,
        "isSchedulingEnabled": false,
        "executionConditions": {
            "@odata.type": "#microsoft.graph.identityGovernance.triggerAndScopeBasedConditions",
            "scope": {
                "@odata.type": "#microsoft.graph.identityGovernance.ruleBasedSubjectSet",
                "rule": "(department eq 'Marketing')"
            },
            "trigger": {
                "@odata.type": "#microsoft.graph.identityGovernance.timeBasedAttributeTrigger",
                "timeBasedAttribute": "employeeHireDate",
                "offsetInDays": 1
            }
        },
        "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": []
            }
        ]
    }
}

例 2: カスタマイズされたメールを使用して新しいバージョンのタスクを作成する

要求

次の例は要求を示しています。

POST https://graph.microsoft.com/beta/identityGovernance/lifecycleWorkflows/workflows/{workflowId}/createNewVersion
Content-Type: application/json
Content-length: 631

{
    "category": "joiner",
    "description": "Configure new hire tasks for onboarding employees on their first day",
    "displayName": "custom email marketing API test",
    "isEnabled": true,
    "isSchedulingEnabled": false,
    "executionConditions": {
        "@odata.type": "#microsoft.graph.identityGovernance.triggerAndScopeBasedConditions",
        "scope": {
            "@odata.type": "#microsoft.graph.identityGovernance.ruleBasedSubjectSet",
            "rule": "(department eq 'Marketing')"
        },
        "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": [
                {
                    "name": "cc",
                    "value": "1baa57fa-3c4e-4526-ba5a-db47a9df95f0"
                },
                {
                    "name": "customSubject",
                    "value": "Welcome to the organization {{userDisplayName}}!"
                },
                {
                    "name": "customBody",
                    "value": "Welcome to our organization {{userGivenName}}!"
                },
                {
                    "name": "locale",
                    "value": "en-us"
                }
            ]
        }
    ]
}

応答

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

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

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

{
    "workflow":{
        "category": "joiner",
        "description": "Configure new hire tasks for onboarding employees on their first day",
        "displayName": "Global onboard new hire employee",
        "isEnabled": true,
        "isSchedulingEnabled": false,
        "executionConditions": {
            "@odata.type": "#microsoft.graph.identityGovernance.triggerAndScopeBasedConditions",
            "scope": {
                "@odata.type": "#microsoft.graph.identityGovernance.ruleBasedSubjectSet",
                "rule": "(department eq 'Marketing')"
            },
            "trigger": {
                "@odata.type": "#microsoft.graph.identityGovernance.timeBasedAttributeTrigger",
                "timeBasedAttribute": "employeeHireDate",
                "offsetInDays": 1
            }
        },
        "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": [
                    {
                    "name": "cc",
                    "value": "b47471b9-af8f-4a5a-bfa2-b78e82398f6e, a7a23ce0-909b-40b9-82cf-95d31f0aaca2"
                },
                {
                "name": "customSubject",
                "value": "Welcome to the organization {{userDisplayName}}!"
                },
                {
                "name": "customBody",
                "value": "Welcome to our organization {{userGivenName}} {{userSurname}}. \nFor more information, reach out to your manager {{managerDisplayName}} at {{managerEmail}}."
                },
                {
                "name": "locale",
                "value": "en-us"
                }, 
    ]
            }
        ]
    }
}

例 3: 特定の管理スコープを持つワークフローの新しいバージョンを作成する

要求

次の例は要求を示しています。

POST https://graph.microsoft.com/beta/identityGovernance/lifecycleWorkflows/workflows/{workflowId}/createNewVersion


{
  "workflow": {
    "category": "mover",
    "displayName": "On Demand mover workflow",
    "description": "Execute real-time tasks for employee job changes",
    "tasks": [
      {
        "category": "mover",
        "continueOnError": false,
        "description": "Send email to notify user’s manager of user move",
        "displayName": "Send email to notify manager of user move",
        "executionSequence": 1,
        "id": "f09eb640-6c16-4f1a-8b48-6a295a307705",
        "isEnabled": true,
        "taskDefinitionId": "aab41899-9972-422a-9d97-f626014578b7",
        "arguments": []
      },
      {
        "arguments": [
          {
            "name": "groupID",
            "value": "8d1d1deb-2ef0-4f72-a460-729a1cc74e7e"
          }
        ],
        "description": "Add user to selected groups",
        "displayName": "Add user to groups",
        "isEnabled": true,
        "continueOnError": false,
        "taskDefinitionId": "22085229-5809-45e8-97fd-270d28d66910",
        "category": "joiner,leaver,mover"
      }
    ],
    "executionConditions": {
      "@odata.type": "#microsoft.graph.identityGovernance.onDemandExecutionOnly"
    },
    "isEnabled": true,
    "isSchedulingEnabled": false,
    "administrationScopeTargets": [
      {
        "@odata.type": "#microsoft.graph.administrativeUnit",
        "id": "2ae6f1b1-fcbf-4ad1-9f4f-8c5e48e364c7"
      }
    ]
  }
}

応答

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

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

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

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.identityGovernance.workflow",
  "category": "mover",
  "description": "Execute real-time tasks for employee job changes",
  "displayName": "On Demand mover workflow",
  "isEnabled": true,
  "isSchedulingEnabled": false,
  "lastModifiedDateTime": "2025-01-09T15:40:14.4514101Z",
  "createdDateTime": "2025-01-09T15:28:24.0565526Z",
  "deletedDateTime": null,
  "id": "394f5831-b1c2-44b3-830d-bbcb88d4ebb0",
  "nextScheduleRunDateTime": null,
  "version": 2,
  "executionConditions": null,
  "lastModifiedBy": {
    "id": "03ad19ba-bf80-4900-bee0-7f6813ee6ecf"
  },
  "tasks@odata.context": "https://graph.microsoft.com/v1.0/$metadata#identityGovernance/lifecycleWorkflows/workflows('465d0d08-3099-483f-9d93-16aad77bcd22')('465d0d08-3099-483f-9d93-16aad77bcd22')/tasks",
  "tasks": [
    {
      "category": "mover",
      "continueOnError": false,
      "description": "Send email to notify user’s manager of user move",
      "displayName": "Send email to notify manager of user move",
      "executionSequence": 1,
      "id": "c070b422-17e3-45a2-82a0-42b5a46c2421",
      "isEnabled": true,
      "taskDefinitionId": "aab41899-9972-422a-9d97-f626014578b7",
      "arguments": []
    },
    {
      "category": "joiner,leaver,mover",
      "continueOnError": false,
      "description": "Add user to selected groups",
      "displayName": "Add user to groups",
      "executionSequence": 2,
      "id": "71b576f8-da57-457f-a507-e7b978c56680",
      "isEnabled": true,
      "taskDefinitionId": "22085229-5809-45e8-97fd-270d28d66910",
      "arguments": [
        {
          "name": "groupID",
          "value": "8d1d1deb-2ef0-4f72-a460-729a1cc74e7e"
        }
      ]
    }
  ],
  "createdBy": {
    "id": "03ad19ba-bf80-4900-bee0-7f6813ee6ecf"
  },
  "administrationScopeTargets": [
    {
      "@odata.type": "#microsoft.graph.administrativeUnit",
      "id": "2ae6f1b1-fcbf-4ad1-9f4f-8c5e48e364c7"
    }
  ]
}

例 4: ターゲット スコープを削除するムーバー ワークフローの新しいバージョンを作成する

要求

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

  • これは"ムーバー" ワークフローが有効で、オンデマンドでのみ実行するように設定されています。
  • 管理者スコープのターゲット引数が空であるため、ターゲット スコープが設定されていないユーザーに対して実行されます。
  • 2 つのタスクが実行されます。これは、移動をユーザーのマネージャーに通知する電子メールを送信し、特定のグループにユーザーを追加することです。
POST https://graph.microsoft.com/beta/identityGovernance/lifecycleWorkflows/workflows/{workflowId}/createNewVersion

{
  "workflow": {
    "category": "mover",
    "displayName": "Remove existing target scope of a workflow",
    "description": "On-demand removal of the target scope of a workflow.",
    "tasks": [
      {
        "category": "mover",
        "continueOnError": false,
        "description": "Send email to notify user’s manager of user move",
        "displayName": "Send email to notify manager of user move",
        "executionSequence": 1,
        "id": "f09eb640-6c16-4f1a-8b48-6a295a307705",
        "isEnabled": true,
        "taskDefinitionId": "aab41899-9972-422a-9d97-f626014578b7",
        "arguments": []
      },
      {
        "arguments": [
          {
            "name": "groupID",
            "value": "5fa668df-a7b0-43fe-828d-48f7a1f7ca44"
          }
        ],
        "description": "Add user to selected groups",
        "displayName": "Add user to groups",
        "isEnabled": true,
        "continueOnError": false,
        "taskDefinitionId": "22085229-5809-45e8-97fd-270d28d66910",
        "category": "joiner,leaver,mover"
      }
    ],
    "executionConditions": {
      "@odata.type": "#microsoft.graph.identityGovernance.onDemandExecutionOnly"
    },
    "isEnabled": true,
    "isSchedulingEnabled": false,
    "administrationScopeTargets": []
  }
}

応答

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

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

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

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#microsoft.graph.identityGovernance.workflow",
  "category": "mover",
  "description": "On-demand removal of the target scope of a workflow.",
  "displayName": "Remove existing target scope of a workflow",
  "isEnabled": true,
  "isSchedulingEnabled": false,
  "lastModifiedDateTime": "2025-01-09T15:40:14.4514101Z",
  "createdDateTime": "2025-01-09T15:28:24.0565526Z",
  "deletedDateTime": null,
  "id": "394f5831-b1c2-44b3-830d-bbcb88d4ebb0",
  "nextScheduleRunDateTime": null,
  "version": 2,
  "executionConditions": null,
  "lastModifiedBy": {
    "id": "2355df95-8fd8-499c-adcf-4b5f1acf713d"
  },
  "tasks@odata.context": "https://graph.microsoft.com/beta/$metadata#identityGovernance/lifecycleWorkflows/workflows('e64ec370-8b6c-4eb7-a692-a07ffa26dc1f')('e64ec370-8b6c-4eb7-a692-a07ffa26dc1f')/tasks",
  "tasks": [
    {
      "category": "mover",
      "continueOnError": false,
      "description": "Send email to notify user’s manager of user move",
      "displayName": "Send email to notify manager of user move",
      "executionSequence": 1,
      "id": "c070b422-17e3-45a2-82a0-42b5a46c2421",
      "isEnabled": true,
      "taskDefinitionId": "aab41899-9972-422a-9d97-f626014578b7",
      "arguments": []
    },
    {
      "category": "joiner,leaver,mover",
      "continueOnError": false,
      "description": "Add user to selected groups",
      "displayName": "Add user to groups",
      "executionSequence": 2,
      "id": "71b576f8-da57-457f-a507-e7b978c56680",
      "isEnabled": true,
      "taskDefinitionId": "22085229-5809-45e8-97fd-270d28d66910",
      "arguments": [
        {
          "name": "groupID",
          "value": "5fa668df-a7b0-43fe-828d-48f7a1f7ca44"
        }
      ],
      "administrationScopeTargets": []
    }
  ],
  "createdBy": {
    "id": "2355df95-8fd8-499c-adcf-4b5f1acf713d"
  }
}