| title | Create trainingCampaign |
|---|---|
| description | Create a new trainingCampaign object. |
| author | akgraph |
| ms.localizationpriority | medium |
| ms.subservice | security |
| doc_type | apiPageType |
| ms.date | 06/10/2024 |
Namespace: microsoft.graph
[!INCLUDE beta-disclaimer]
Create a new trainingCampaign object.
[!INCLUDE national-cloud-support]
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.
[!INCLUDE permissions-table]
POST /security/attackSimulation/trainingCampaigns| Name | Description |
|---|---|
| Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
| Content-Type | application/json. Required. |
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. |
If successful, this method returns a 202 Accepted response code and a tracking header named location in the response.
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"
}
}[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
HTTP/1.1 202 Accepted