Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New-MgBetaSecurityAttackSimulationTrainingCampaign / Training campaign (preview) #2953

Closed
marcinsamuel opened this issue Sep 11, 2024 · 1 comment

Comments

@marcinsamuel
Copy link

Describe the bug

I try to create a new training campaign and use for that New-MgBetaSecurityAttackSimulationTrainingCampaign cmdlet. Morover I tested Microsoft Graph REST, POST request directly from PowerShell (Invoke-WebRequest) and Microsoft Graph Explorer. Sadly in every case I got the same error.

{"Code":400,"Message":"AssignedTo object missing in trainingAssignmentMappings[0]",
"Target":null,"Details":null,"InnerError":null}  Status: 400 (BadRequest) ErrorCode: UnknownError}

Expected behavior

Method returns a 202 Accepted and new training campaign is created on https://security.microsoft.com/attacksimulator

How to reproduce

Execute a code sample from an official documentation

SDK Version

2.23.0 Microsoft.Graph.Beta.Security

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

New-MgBetaSecurityAttackSimulationTrainingCampaign -BodyParameter $params -Debug
DEBUG: [CmdletBeginProcessing]: - New-MgBetaSecurityAttackSimulationTrainingCampaign begin processing with parameterSet 'Create'.
DEBUG: [Authentication]: - AuthType: 'AppOnly', TokenCredentialType: 'ClientSecret', ContextScope: 'Process', AppName: 'DEV_ATTACK_SIMULATION_TRAINING'.
DEBUG: [Authentication]: - Scopes: [User.Read.All, AttackSimulation.ReadWrite.All].

Confirm
Are you sure you want to perform this action?
Performing the operation "New-MgBetaSecurityAttackSimulationTrainingCampaign_Create" on target "Call remote 'POST /security/attackSimulation/trainingCampaigns' operation".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
POST

Absolute Uri:
https://graph.microsoft.com/beta/security/attackSimulation/trainingCampaigns

Headers:
FeatureFlag                   : 00000043
Cache-Control                 : no-store, no-cache
User-Agent                    : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.19045; en-US),PowerShell/2024.2.2
Accept-Encoding               : gzip
SdkVersion                    : graph-powershell-beta/2.23.0
client-request-id             : 9721a794-0b07-4363-b781-6f8521d0c942

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


DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
BadRequest

Headers:
Vary                          : Accept-Encoding
Strict-Transport-Security     : max-age=31536000
request-id                    : 7efc3295-e18b-4a03-adde-e06cfe456da1
client-request-id             : 9721a794-0b07-4363-b781-6f8521d0c942
x-ms-ags-diagnostic           : {"ServerInfo":{"DataCenter":"Switzerland North","Slice":"E","Ring":"3","ScaleUnit":"001","RoleInstance":"ZRH2EPF000000E0"}}
Date                          : Wed, 11 Sep 2024 16:52:03 GMT

Body:
{
  "error": {
    "code": "UnknownError",
    "message": "{\"Code\":400,\"Message\":\"AssignedTo object missing in trainingAssignmentMappings[0]\",\"Target\":null,\"Details\":null,\"InnerError\":null}",
    "innerError": {
      "date": "2024-09-11T16:52:04",
      "request-id": "7efc3295-e18b-4a03-adde-e06cfe456da1",
      "client-request-id": "9721a794-0b07-4363-b781-6f8521d0c942"
    }
  }
}


New-MgBetaSecurityAttackSimulationTrainingCampaign_Create: C:\exchange\newCampaign.ps1:63:1
Line |
  63 |  New-MgBetaSecurityAttackSimulationTrainingCampaign -BodyParameter $pa …
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | {"Code":400,"Message":"AssignedTo object missing in trainingAssignmentMappings[0]","Target":null,"Details":null,"InnerError":null}  Status: 400 (BadRequest) ErrorCode:
     | UnknownError Date: 2024-09-11T16:52:04  Headers: Vary                          : Accept-Encoding Strict-Transport-Security     : max-age=31536000 request-id
     | : 7efc3295-e18b-4a03-adde-e06cfe456da1 client-request-id             : 9721a794-0b07-4363-b781-6f8521d0c942 x-ms-ags-diagnostic           :
     | {"ServerInfo":{"DataCenter":"Switzerland North","Slice":"E","Ring":"3","ScaleUnit":"001","RoleInstance":"ZRH2EPF000000E0"}} Date                          : Wed, 11 Sep 2024     
     | 16:52:03 GMT
DEBUG: [CmdletEndProcessing]: - New-MgBetaSecurityAttackSimulationTrainingCampaign end processing.

Configuration

  • OS:
    • Windows 10
    • Windows 11
  • PS:
    • 5.1
    • 7.4

Other information

I am not 100% confident when POST call has stopped working but I would guess mid/end August 2024. I would appreciate if you could contact Microsoft Graph Beta development team and validate changes for an /security/attackSimulation/trainingCampaigns endpoint introduced in last 30 days.

@marcinsamuel marcinsamuel added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Sep 11, 2024
@timayabi2020 timayabi2020 added Service issue and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Sep 18, 2024
@timayabi2020
Copy link
Contributor

@marcinsamuel thank you for raising this issue. However, for API related issues/questions we are not best placed to give an answer. Kindly raise an issue here https://developer.microsoft.com/en-us/graph/support so that the API owner can respond to it. Also see refer to the API reliability and support guide here https://learn.microsoft.com/en-us/graph/best-practices-concept#reliability-and-support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants