Closed gabrielsroka closed 9 months ago
that should actually be easy if I get this correctly. simply do this:
okta-cli users list --search 'profile.department eq "IT"' --csv > tmp.csv
okta-cli users bulk-update -s profile.department="New IT" tmp.csv
bulk-updating using the API is always slow, actually :( . last time i looked (not recently) there has not been a bulk-update endpoint. at least okta-cli is parallelizing the requests to the API, so you'll probably get the most of it.
I wanted to use the cli for bulk-updates, but this requires a csv (or some intermediary file). would something like this be recommended instead? it "works", but a) it's slow (cuz it spawns the cli many times, and it can't reuse the
requests.Session()
, b) is it good? i'm not much of a shell programmer. it'd be nice to have something more like what you can do in SQL:again, example use cases would be nice -- how do you use the cli?
or
@flypenguin replied https://github.com/flypenguin/okta-cli/issues/15#issuecomment-1812273781 yes, this is slow. your idea in q8 was "the right one", unfortunately if i'm correct you hit an Okta limitation. yet okta-cli can still help you ;) . --match filters after downloading the users (i.e. not using the API), in contrast to -f, -s, and -q. so modify your first command in question q8 like this: okta-cli users list --partial --match "profile.department=^IT" (it accepts regexes and needs no quotes IIRC). that should still be much faster than your q7 approach.
--
my follow-up:
i don't understand. plus, if u have 1 million users, it doesn't make sense to fetch all of them in order to update 10 of them