We would like you to demonstrate your ability to do some minor automation against the Core Okta API (https://developer.okta.com/docs/reference/core-okta-api/). To get started you will need to create an Okta Developer org ( https://developer.okta.com/docs/guides/quickstart/website/create-org/#create-your-org ), then get your Token in the Okta Admin from: Security > API > Tokens.
Write the tool in any scripting language of your choice (Ex: Python, Shell, Ruby, etc) that completes the following tasks:
- Use an Okta admin token via envvar
- Create user.
- Create Multiple Users
- List all users in the Okta account with their First Name, Last Name, Username & Account Status
- Delete user.
i) OKTA Token is present in an environment variable OKTA_ADMIN_TOKEN.
ii) OKTA Org URL is present in an environment variable OKTA_ORG.
iii) You have Python3 and pip3 installed on your machine.
i) Clone this repo. ii) Create and Activate a Venv
python3 -m venv env
source env/bin/activate
iii) Install requirements
pip3 install -r requirements.txt
We have 4 options with this CLI:
We can use this option to create one user at a time. This option accepts 3 mandatory paramaters i.e FirstName, Lastname and EmailID.
Example:
$> python3 main.py create-user Firstname LastName [email protected]
We can use this option to list FirstName, Lastname, Username and Status of all users in the Okta Org
Example:
$> python3 main.py list-users
FirstName: Sanchari LastName: Sarma Username: [email protected] Status: PROVISIONED
FirstName: Akshay LastName: Patil Username: [email protected] Status: ACTIVE
FirstName: kxkbpmui LastName: sfyzdlrv Username: [email protected] Status: ACTIVE
FirstName: rvvtwagl LastName: pjvaibyl Username: [email protected] Status: ACTIVE
We can use this option to automatically create users in bulk. Our CLI will generate random strings to create these users. This option just accepts an integer as an option.
Example:
$> python3 main.py create-bulk-users 3
User [email protected] created successfully
User [email protected] created successfully
User [email protected] created successfully
We can use this option to delete a single user in OKTA org.
Example:
$> python3 main.py delete-user [email protected]
User Deprovisioned Successfully
User [email protected] deleted successfully
i) As I have used typer to create this cli, we can just put --help in our cli command to get more information and parameters about the cli command
Example:
$> python3 main.py create-user --help
Usage: main.py create-user [OPTIONS] FIRSTNAME LASTNAME EMAIL
Arguments:
FIRSTNAME [required]
LASTNAME [required]
EMAIL [required]
Options:
--help Show this message and exit.
ii) I have not added unit tests at the moment, but I can add them easily if more time is given.