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 an attack simulation campaign for a tenant.
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Permission type
Permissions (from least to most privileged)
Delegated (work or school account)
AttackSimulation.ReadWrite.All
Delegated (personal Microsoft account)
Not supported.
Application
AttackSimulation.ReadWrite.All
HTTP request
POST /security/attackSimulation/simulations
Request headers
Header
Value
Authorization
Bearer {token}. Required.
Content-Type
application/json
Request body
In the request body, supply a JSON representation of a simulation object.
The following table shows the properties that are required when you create the simulation.
The social engineering technique used in the attack simulation and training campaign. Supports $filter and $orderby. Possible values are: unknown, credentialHarvesting, attachmentMalware, driveByUrl, linkInAttachment, linkToMalwareFile, unknownFutureValue. For more information on the types of social engineering attack techniques, see simulations.
Attack type of the attack simulation and training campaign. Supports $filter and $orderby. Possible values are: unknown, social, cloud, endpoint, unknownFutureValue.
completionDateTime
DateTimeOffset
Date and time of completion of the attack simulation and training campaign. Supports $filter and $orderby.
Identity of the user who most recently modified the attack simulation and training campaign.
launchDateTime
DateTimeOffset
Date and time of the launch/start of the attack simulation and training campaign. Supports $filter and $orderby.
payloadDeliveryPlatform
payloadDeliveryPlatform
Method of delivery of the phishing payload used in the attack simulation and training campaign. Possible values are: unknown, sms, email, teams, unknownFutureValue.
Status of the attack simulation and training campaign. Supports $filter and $orderby. Possible values are: unknown, draft, running, scheduled, succeeded, failed, cancelled, excluded, unknownFutureValue.
Response
If successful, this method returns a 202 Accepted response code and a tracking header named location in the response.
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var simulation = new Simulation
{
DisplayName = "Graph Simulation",
PayloadDeliveryPlatform = PayloadDeliveryPlatform.Email,
DurationInDays = 7,
AttackTechnique = SimulationAttackTechnique.CredentialHarvesting,
AttackType = SimulationAttackType.Social,
Status = SimulationStatus.Scheduled,
CompletionDateTime = DateTimeOffset.Parse("2022-09-16T06:13:08.4297612Z"),
LaunchDateTime = DateTimeOffset.Parse("2022-09-05T06:13:08.4297612Z"),
IncludedAccountTarget = new AddressBookAccountTargetContent
{
Type = AccountTargetContentType.AddressBook,
AccountTargetEmails = new List<String>()
{
"john@contoso.com"
}
},
AdditionalData = new Dictionary<string, object>()
{
{"payload@odata.bind", "https://graph.microsoft.com/beta/security/attacksimulation/payloads/12345678-9abc-def0-123456789a"}
}
};
await graphClient.Security.AttackSimulation.Simulations
.Request()
.AddAsync(simulation);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new Simulation();
$requestBody->setDisplayName('Graph Simulation');
$requestBody->setPayloadDeliveryPlatform(new PayloadDeliveryPlatform('email'));
$requestBody->setDurationInDays(7);
$requestBody->setAttackTechnique(new SimulationAttackTechnique('credentialharvesting'));
$requestBody->setAttackType(new SimulationAttackType('social'));
$requestBody->setStatus(new SimulationStatus('scheduled'));
$requestBody->setCompletionDateTime(new DateTime('2022-09-16T06:13:08.4297612Z'));
$requestBody->setLaunchDateTime(new DateTime('2022-09-05T06:13:08.4297612Z'));
$includedAccountTarget = new AccountTargetContent();
$includedAccountTarget->set@odatatype('#microsoft.graph.addressBookAccountTargetContent');
$includedAccountTarget->setType(new AccountTargetContentType('addressbook'));
$additionalData = [
'accountTargetEmails' => ['john@contoso.com', ],
];
$includedAccountTarget->setAdditionalData($additionalData);
$requestBody->setIncludedAccountTarget($includedAccountTarget);
$additionalData = [
'payload@odata.bind' => 'https://graph.microsoft.com/beta/security/attacksimulation/payloads/12345678-9abc-def0-123456789a',
];
$requestBody->setAdditionalData($additionalData);
$requestResult = $graphServiceClient->security()->attackSimulation()->simulations()->post($requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.