Public/remove-AllegisIDNAccount.ps1

function remove-AllegisIDNAccount ($orgname, $IDNClientID, $IDNClientKey, $accesstoken, $accountid){
    if (!!$IDNClientID -and !!$IDNClientKey){
        $header = get-AllegisIDNBasicAuthHeader -IDNClientID $IDNClientID -IDNClientKey $IDNClientKey
    }elseif(!!$accesstoken){
        $header=get-AllegisIDNprivateHeader $accessToken
    }
    if (!$header){Write-Warning 'unable to create an auth header with provided parameters';return $null}
    $url="https://$orgname.api.identitynow.com/v2/accounts/$($accountid)?org=$orgname"
    $response=Invoke-WebRequest -UseBasicParsing -Uri $url -Headers $header -Method delete
    $account=$response.Content | ConvertFrom-Json
    return $account
}