Powershell Microsoft.Graph.Beta.Security module - Training Campaign stuck at scheduled status
I'm trying to create a Training Campaign in Microsoft Security Admin Center through powershell.
Below is the documentation I'm referring to:
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?
Import-Module Microsoft.Graph.Beta.Security
$params = @{
displayName = "[New]Security Training Campaign"
description = "New joiner security training"
createdBy = @{
email = "admin@domain.com"
}
lastModifiedBy = @{
email = "admin@domain.com"
}
includedAccountTarget = @{
type = "addressBook"
accountTargetEmails = @(
"user@domain.com"
)
}
endUserNotificationSetting = @{
notificationPreference = "microsoft"
settingType = "trainingSelected"
trainingReminder = @{
deliveryFrequency = "biweekly"
"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('7e33ea14-489d-4c37-9668-9402c91d4e0e')"
}
@{
assignedTo = @(
"allUsers"
)
"training@odata.bind" = "https://graph.microsoft.com/beta/security/attackSimulation/trainings('2fd88a75-7195-49a5-a5d8-a94cc1219207')"
}
@{
assignedTo = @(
"allUsers"
)
"training@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