Powershell Microsoft.Graph.Beta.Security module - Training Campaign stuck at scheduled status

Joshua William 0 Reputation points
2024-11-22T06:32:21.8266667+00:00

I'm trying to create a Training Campaign in Microsoft Security Admin Center through powershell.

Below is the documentation I'm referring to:

https://learn.microsoft.com/en-us/graph/api/attacksimulationroot-post-trainingcampaigns?view=graph-rest-beta&tabs=powershell

Below is the Powershell script. Trainings that were created through the script are stuck at scheduled status. If created though the GUI, within 5mins the status changed to InProgress. Am i missing something on the script, has anyone made it work?TrainingCampaign

Import-Module Microsoft.Graph.Beta.Security

$params = @{

displayName = "[New]Security Training Campaign"

description = "New joiner security training"

createdBy = @{

email = "******@domain.com"

}

lastModifiedBy = @{

email = "******@domain.com"

}

includedAccountTarget = @{

type = "addressBook"

accountTargetEmails = @(

"******@domain.com"

)

}

endUserNotificationSetting = @{

notificationPreference = "microsoft"

settingType = "trainingSelected"

trainingReminder = @{

deliveryFrequency = "biweekly"

"******@odata.bind" = "https://graph.microsoft.com/beta/security/attackSimulation/endUserNotifications('fe521249-9901-4584-a987-026a9980c58e')"

defaultLanguage = "en"

}

trainingAssignment = @{

"******@odata.bind" = "https://graph.microsoft.com/beta/security/attackSimulation/endUserNotifications('36fb4dc1-7c37-4b96-9096-12e6d6014fae')"

defaultLanguage = "en"

}

}

trainingSetting = @{

settingType = "microsoftCustom"

trainingAssignmentMappings = @(

@{

assignedTo = @(

"allUsers"

)

"******@odata.bind" = "https://graph.microsoft.com/beta/security/attackSimulation/trainings('7e33ea14-489d-4c37-9668-9402c91d4e0e')"

}

@{

assignedTo = @(

"allUsers"

)

"******@odata.bind" = "https://graph.microsoft.com/beta/security/attackSimulation/trainings('2fd88a75-7195-49a5-a5d8-a94cc1219207')"

}

@{

assignedTo = @(

"allUsers"

)

"******@odata.bind" = "https://graph.microsoft.com/beta/security/attackSimulation/trainings('4fecad2a-f23c-40c4-86e6-99810d35e1f0')"

}

)

}

campaignSchedule = @{

launchDateTime = [System.DateTime]::Parse("2024-11-22T14:05:00Z")

completionDateTime = [System.DateTime]::Parse("2024-11-22T23:59:00Z")

status = "scheduled"

}

}

New-MgBetaSecurityAttackSimulationTrainingCampaign -BodyParameter $params

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Your answer

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