Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Create SailPoint IdentityNow Manager Certification Campaign. Supporting Blog Post can be found here https://blog.darrenjrobinson.com/creating-sailpoint-identitynow-certification-campaigns-using-powershell/
# Create Campaign URI
$createCampaignURI = "https://$($orgName).api.identitynow.com/cc/api/campaign/create"
# Get Campaign Base URI
$GetCampaignBaseURI = "https://$($orgName).api.identitynow.com/cc/api/campaign/get"
# Activate Campaign URI
$activateCampaignURI = "https://$($orgName).api.identitynow.com/cc/api/campaign/activate"
# Create Campaign
$campaignOptions = @{}
$campaignOptions.Add("type", "Identity")
$campaignOptions.Add("timeZone", "GMT+1100")
$campaignOptions.Add("name", "15 Nov 2018 Campaign")
$campaignOptions.Add("allowAutoRevoke", $false)
$campaignOptions.Add("deadline", "2018-11-30")
$campaignOptions.Add("description", "Active Directory Nov 2018")
$campaignOptions.Add("disableEmail", $false)
$campaignOptions.Add("identityIdList", @())
$campaignOptions.Add("identityQueryString", $query)
$campaignOptions.Add("accessInclusionList", $inclusionList)
$campaignBody = $campaignOptions | ConvertTo-Json
If ($campaignBody) {
# Create Campaign
$createResult = Invoke-RestMethod -Method Post -uri $createCampaignURI -Body $campaignBody -WebSession $IDN
start-sleep -Seconds 10
if ($createResult) {
$GetCampaignURI = "$($GetCampaignBaseURI)/$($createResult.id)"
$IDN.Headers.Remove("Content-Type")
# Get Campaign
$campaignStatus = Invoke-RestMethod -Method Get -Uri $GetCampaignURI -WebSession $IDN
if ($campaignStatus.status.Equals("Staged")) {
try {
# Activate Campaign
$activateBody = "campaignId=$($createResult.id)&timeZone=GMT%2B11%3A00"
Invoke-RestMethod -Method Post -Uri $activateCampaignURI -Body $activateBody -WebSession $IDN
write-host -ForegroundColor Blue "Campaign $($createResult.description) successfully created and started."
}
catch {
write-host -ForegroundColor Red "Campaign $($createResult.description) was not successfully started."
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.