cyberark / epv-api-scripts

These API scripts enable CyberArk users to automate privileged account management task like account creation, user management, and more.

Home Page:https://www.cyberark.com/best

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

account_onboard_utility slow with search if only "objectname" is provided

ELANDJEA opened this issue · comments

Summary

when prooviding only safename and objectname (name) while trying to update objects in a big safe, the script can take more than 30 seconds per entry to update.

Provide brief overview and context for the discovered bug.

Steps to Reproduce

perform update on entries in big safe

Version/Tag number

version 2.2.2 of the script

Environment setup

safe with 3000+ entries

Additional Information

THis result is caused by the search within "get-account" function.
if the objectname is given, it first fetches all entries in the safe and after that find the correct objectname.

By adding the objectname also in the search, PVWA directly returns a limited number of entries instead of the 3000+ entries.

current line in get-account:
$urlSearchAccount = $URL_Accounts + "?filter=safename eq $(ConvertTo-URL $safeName)"

if the line is updated to also include the objectname, the update process is done within a fraction of a second.
new content of the line:
$urlSearchAccount = $URL_Accounts + "?filter=safename eq $(ConvertTo-URL $safeName)&search=$(ConvertTo-URL $accountObjectName)"

(sorry....I am not enough a developer to propose this change in the code myself via github functionality at this moment)

commented

I would need to see the final URL that you are passing. Filter only accepts safeName and modificationTime. For you to be able to search on ObjectName successfully you need to have "wideAccountsSearch" set to "Yes", which is not on in new environments or in PCloud.

I have been working on a way to redesign this to allow for faster results when working with "objectName" including the option to do a search with objectName with the assumption that wideAccoutnsSearch is set to "Yes"

Normally right now if you are passing an objectName (name) on creates you can use -BypassAccountSearch safely. Since CyberArk will not allow for the same objectName to be created twice it will cause an error on creation instead of a duplicate account.