Error when Creating Email Simulation using Microsoft Graph Explorer

Sana Qazi 0 Reputation points
2023-11-01T08:30:27.01+00:00

I'm attempting to create a simulation email with Microsoft Graph Explorer but have encountered an error message labeled with "BadRequest." It's related to the "endUserNotification" property within the payload; the provided value does not conform to the expected schema. The error message includes the following JSON:

"error": {
        "code": "BadRequest",
        "message": "Property endUserNotification in payload has a value that does not match schema.",
        "innerError": {
            "date": "2023-11-01T05:56:30",
            "request-id": "ceccb0a9-699a-4245-a286-a77516bdfdab",
            "client-request-id": "b0c432f7-9ec1-b355-17fc-9f9c16c0609f"
        }

I've referred to an example from Microsoft on creating simulations, but the error persists. The example is available at:

https://learn.microsoft.com/en-us/graph/api/attacksimulationroot-post-simulation?view=graph-rest-1.0

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,456 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Diah.Karim-MSFT 330 Reputation points Microsoft Vendor
    2023-12-27T03:50:44.3866667+00:00

    Hi Sana,

    I think it's easy to get an error due to the payload is quite big and you may be missing some of element of it.

    I have tried from my end it can create the simulation.

    Here is the details:-

    1. Endpoint URL with AttackSimulation.ReadWrite.All consent has been granted.

    POST https://graph.microsoft.com/v1.0/security/attackSimulation/simulations

    1. The body payload
    {
        "attackTechnique": "attachmentMalware",
        "attackType": "endpoint",
        "automationId": "f6759752-f4cb-431a-a21d-078cf0b00ba3",
        "completionDateTime": "2023-12-30T14:01:27.812Z",
        "createdBy": {
            "displayName": "Admin",
            "email": "mohddiah@1cpzfr.onmicrosoft.com",
            "id": "f6759752-f4cb-431a-a21d-078cf0b00ba4"
        },
        "createdDateTime": "2023-12-24T14:01:27.812Z",
        "description": "Simulation Test calling from MS Graph API",
        "displayName": "Simulation Test",
        "durationInDays": "340",
        "endUserNotificationSetting": {
            "notificationPreference": "microsoft",
            "positiveReinforcement": {
                "defaultLanguage": "En",
                "deliveryPreference": "deliverImmedietly"
            },
            "settingType": "noNotification"
        },
        "excludedAccountTarget": {
            "type": "addressBook"
        },
        "id": "72328d46-de95-43e0-ad7d-d4f3ac34139b",
        "includedAccountTarget": {
            "type": "addressBook"
        },
        "isAutomated": true,
        "lastModifiedBy": {
            "displayName": "Admin",
            "email": "mohddiah@1cpzfr.onmicrosoft.com",
            "id": "f6759752-f4cb-431a-a21d-078cf0b00ba4"
        },
        "lastModifiedDateTime": "2023-12-25T14:01:27.812Z",
        "launchDateTime": "2023-12-24T14:01:27.812Z",
        "oAuthConsentAppDetail": {
            "appScope": "unknown",
            "displayLogo": "App display logo",
            "displayName": "App name"
        },
        "payloadDeliveryPlatform": "email",
        "report": {
            "overview": {
                "recommendedActions": [
                    {
                        "actionWebUrl": "http://www.url.com",
                        "potentialScoreImpact": "2",
                        "title": "Penetration Test Accessment"
                    }
                ],
                "resolvedTargetsCount": "2",
                "simulationEventsContent": {
                    "compromisedRate": "50",
                    "events": [
                        {
                            "count": "2",
                            "eventName": "Testing"
                        }
                    ]
                },
                "trainingEventsContent": {
                    "assignedTrainingsInfos": [
                        {
                            "assignedUserCount": "10",
                            "completedUserCount": "10",
                            "displayName": "Test User"
                        }
                    ],
                    "trainingsAssignedUserCount": "10"
                }
            },
            "simulationUsers": [
                {
                    "assignedTrainingsCount": "10",
                    "completedTrainingsCount": "12",
                    "compromisedDateTime": "2023-12-24T14:01:27.812Z",
                    "inProgressTrainingsCount": "5",
                    "isCompromised": true,
                    "reportedPhishDateTime": "2023-12-28T14:01:27.812Z",
                    "simulationEvents": [
                        {
                            "browser": "edge",
                            "eventDateTime": "2023-12-28T14:01:27.812Z",
                            "eventName": "Attacker",
                            "ipAddress": "10.1.1.0.1",
                            "osPlatformDeviceDetails": "windows"
                        }
                    ],
                    "simulationUser": {
                        "displayName": "Tester",
                        "email": "mddiah@1cpzfr.onmicrosoft.com",
                        "userId": "f6759752-f4cb-431a-a21d-078cf0b00ba5"
                    },
                    "trainingEvents": [
                        {
                            "displayName": "Test Simulation",
                            "latestTrainingStatus": "unknown",
                            "trainingAssignedProperties": {
                                "browser": "edge",
                                "eventDateTime": "2023-12-28T14:01:27.812Z",
                                "eventName": "Attacker",
                                "ipAddress": "10.1.1.0.1",
                                "osPlatformDeviceDetails": "windows",
                                "potentialScoreImpact": 2
                            },
                            "trainingCompletedProperties": {
                                "browser": "edge",
                                "eventDateTime": "2023-12-28T14:01:27.812Z",
                                "eventName": "Attacker",
                                "ipAddress": "10.1.1.0.1",
                                "osPlatformDeviceDetails": "windows",
                                "potentialScoreImpact": 3
                            },
                            "trainingUpdatedProperties": {
                                "browser": "edge",
                                "eventDateTime": "2023-12-28T14:01:27.812Z",
                                "eventName": "Attacker",
                                "ipAddress": "10.1.1.0.1",
                                "osPlatformDeviceDetails": "windows",
                                "potentialScoreImpact": 4
                            }
                        }
                    ]
                }
            ]
        },
        "status": "unknown",
        "trainingSetting": {
            "settingType": "noTraining"
        }
    }
    

    Hope this helps.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.