編輯

共用方式為


Create trainingCampaign

Namespace: microsoft.graph

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.

Create a new trainingCampaign object.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

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) AttackSimulation.ReadWrite.All Not available.
Delegated (personal Microsoft account) Not supported. Not supported.
Application AttackSimulation.ReadWrite.All Not available.

HTTP request

POST /security/attackSimulation/trainingCampaigns

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 trainingCampaign object.

You can specify the following properties when creating a trainingCampaign.

Property Type Description
createdBy emailIdentity The identity of the user who created the training campaign. Optional.
createdDateTime DateTimeOffset The date and time when the training campaign was created. Optional.
description String The description of the training campaign. Optional.
displayName String The display name of the training campaign. Required.
endUserNotificationSetting endUserNotificationSetting Details about the end user notification setting. Required.
excludedAccountTarget accountTargetContent The users who are excluded from the training campaign. Optional.
includedAccountTarget accountTargetContent The users who are targeted in the training campaign. Required.
lastModifiedDateTime DateTimeOffset The identity of the user who most recently modified the training campaign. Optional.
trainingSetting trainingSetting Details about the training settings for a training campaign. Required.
campaignSchedule campaignSchedule Details about the schedule and current status for a training campaign. Required.

Response

If successful, this method returns a 202 Accepted response code and a tracking header named location in the response.

Examples

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/security/attackSimulation/trainingCampaigns
Content-Type: application/json

{
    "displayName": "Graph Training Campaign",
    "description": "Graph Training Campaign Description",
    "createdBy": {
        "email": "john@contoso.com"
    },
    "lastModifiedBy": {
        "email": "john@contoso.com"
    },
    "includedAccountTarget": {
        "type": "addressBook",
        "accountTargetEmails": [
            "john@contoso.com"
        ]
    },
    "endUserNotificationSetting": {
        "notificationPreference": "microsoft",
        "settingType": "trainingSelected",
        "trainingReminder": {
            "deliveryFrequency": "weekly",
            "endUserNotification@odata.bind": "https://graph.microsoft.com/beta/security/attackSimulation/endUserNotifications('fe521249-9901-4584-a987-026a9980c58e')",
            "defaultLanguage": "en"
        },
        "trainingAssignment": {
            "endUserNotification@odata.bind": "https://graph.microsoft.com/beta/security/attackSimulation/endUserNotifications('36fb4dc1-7c37-4b96-9096-12e6d6014fae')",
            "defaultLanguage": "en"
        }
    },
    "trainingSetting": {
        "settingType": "microsoftCustom",
        "trainingAssignmentMappings": [
            {
                "assignedTo": [
                    "allUsers"
                ],
                "training@odata.bind": "https://graph.microsoft.com/beta/security/attackSimulation/trainings('40454905-dc26-4f36-b854-3042a5362cb3')"
            },
            {
                "assignedTo": [
                    "allUsers"
                ],
                "training@odata.bind": "https://graph.microsoft.com/beta/security/attackSimulation/trainings('ea70ae06-3859-4818-be9d-270ee81d80a4')"
            },
            {
                "assignedTo": [
                    "allUsers"
                ],
                "training@odata.bind": "https://graph.microsoft.com/beta/security/attackSimulation/trainings('d733d88c-1b5a-48e3-a588-9910e41ac21d')"
            }
        ]
    },
    "campaignSchedule": {
        "launchDateTime": "2024-02-15T07:59:44Z",
        "completionDateTime": "2024-02-18T07:59:44Z",
        "status": "Scheduled"
    }
}

Response

The following example shows the response.

HTTP/1.1 202 Accepted