Package: okta-cli
Okta-CLINOW WITH HOMEBREW TAP ON A MAC - SEE "INSTALLATION" BELOW :))This is a python-based CLI tool for Okta.It is not made or maintained by or in any way affiliated with anyone working at Okta.It is mainly driven by the personal needs of its author, although the feature set is becoming quite complete now.It basically is a CLI wrapper around theOkta REST API.NOTE:This isnotthe same as Okta's ownoktaCLI interface.
The latter is apparently used for setting up the source for development projects.RequirementsA Mac or Linux machine, itmightwork on Windows (untested)Python 3.7+, for the change log seeCHANGES.rst.unfortunatelyPython 3.11 is notyetsupporteddue to a dependency.InstallationMac & homebrewbrewtapflypenguin/okta-cli
brewinstallokta-cliAll otherscreate a python virtualenv:mkvirtualenv okta-clipip install okta-clistart using it:okta-cli config newQuickstartEvery more complex function should have help texts available:okta-cli users add -h, or
maybeokta-cli users update -hor maybeokta-cli apps add -h... those are probably the
most interesting ones.$pipinstallokta-cli# install :)$okta-cliconfignew\# create a new okta profile-nmy-profile-\-uhttps://my.okta.url\-tAPI_TOKEN

$okta-cli-h# get help$okta-cliapps-h# get help$okta-cliappsadduser\# assign an app to a user-amy_app_name-u0109121\-fprofile.employeeId

$okta-cliusers-h# get help$okta-cliuserslist--csv# list all users as csv$okta-cliuserslist\# search users with a query-f'profile.email eq "my@email.com"'$okta-cliusersupdateid012345678\# update a field of a user record--setprofile.email=my@other.email.com
$oktacliusersgroupsadduser\# add a user to a group$okta-cliusersgetmy-login-vvvvv# see http debug output$okta-cliusersbulk-addadd-list.csv# Bulk-ADD users$okta-cliusersbulk-updateupdate-list.xlsx# Bulk-UPDATE users$okta-clifeatures-h# get help$okta-clifeatureslist# list okta server-side features$okta-clifeaturesenable"Recent Activity"# enable an Okta feature-gapp1_rollout\-ufred.flintstone@flintstones.com

$okta-cliversion# print version and exitConfigurationRunningconfig new(see above) will store a JSON configuration file in the directory determined by theappdirsmodule.CSV / Excel file formatsThe commandsbulk-addandbulk-updatecan read from CSV or Excel. Consider this:CSV:the first lineMUSTbe a header line (yes, also in Excel).for the commandbulk-addthereMUSTbe aprofile.logincolumn, and thereMUST NOTbe anidcolumn.for the commandbulk-updatethereMUSTbe either aprofile.loginor anidcolumn, the latter has preference.all other will most probably refer to profile fields, and map to the add/update API call.most probably you will want to haveprofile.FIELDcolumns (e.g.profile.firstName,profile.zipCode, ...).you can see the valid standard field names here:https://developer.okta.com/docs/reference/api/schemas/#user-profile-base-subschema.all columns which do not contain a "." areignored.Excel:ThereMUST NOTbe any formulas.Behavior with more than one sheet is undefined.Apart from that, be aware of number formatting, which ismost probablynot respected byokta-cli.Otherwise, the same restrictions as for csv files apply.Remarks:Some fields have value limitations on the Okta sidee.g.profile.preferredLanguagemust be a valid two-letter country codeExample:In this example, the columns "country" and "gender" are ignored – their name does not contain a ".".profile.login,profile.firstName,profile.lastName,profile.email,gender,profile.streetAddress,profile.zipCode,profile.city,country,profile.countryCode
ibrabben0@prlog.org,Iosep,Brabben,ibrabben0@prlog.org,Male,7931 Division Point,86983 CEDEX,Futuroscope,France,FR(those fields are not part of Okta's standard field set, and this is an easy way to exclude columns from being used)CSV files with only one columnIf for any reason you want to create a CSV file with only one column, do it like this:profile.login,
my@email.com,Note the trailing comma.Reasoning:okta-clitries to determine the column separator, and without one ... determination is tricky, andokta-cliwill shamelessly crash.ReferencesThis project uses a few nice other projects:Clickappdirs