Public/new-IDNaccount.ps1

#
# new_IDNaccount.ps1
#
function new-IDNaccount ($orgName, $authHeader, $sourceid, $newuser){
    $schema=get-IDNsourceSchema -orgName $orgname -authHeader $authHeader -sourceid $sourceid
    $account=@()
    foreach($attr in $schema.attributes.name)
    {
        if ($account.count -eq 0){
            $account=[pscustomobject]@{"$attr"="$($newuser.$attr)"}
        }else{
            $account | Add-Member -NotePropertyName "$attr" -NotePropertyValue "$($newuser.$attr)"
        }
    }
    $url="https://$orgName.api.identitynow.com/v2/accounts?sourceId=$sourceid&org=$orgName"
    $body=$account | ConvertTo-Json -Depth 10
    write-verbose $body
    $response=Invoke-WebRequest -UseBasicParsing -Uri $url -Headers $authHeader -Method Post -Body $body
    $account=$response.Content | ConvertFrom-Json
    return $account
}