Last active
July 27, 2021 14:38
-
-
Save noinarisak/92db375666423c7849471d608dbae87f to your computer and use it in GitHub Desktop.
OKTA-CLI Examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pre-req's | |
# - Validate macOS Mojava 10.14.6 | |
# - pipx (https://pypa.github.io/pipx) - Highly recommended ;) | |
# - okta-cli (from https://pypi.org/project/okta-cli/ not cli that is more creating the OIDC Apps cli) | |
# - jq (https://stedolan.github.io/jq/download/ or 'brew install jq') | |
# | |
# List DEPROVISION users, every attribute | |
okta-cli users list --deprovisioned --json | \ | |
jq '.[]' | |
# List DEPROVISION users, only "id" | |
okta-cli users list -d -j | \ | |
jq '.[] | .id' | |
# List DEPROVISION users, only "id" and "email" | |
okta-cli users list -d -j | \ | |
jq '.[] | [.id, .profile.email]' | |
### | |
# NOTE: To completely delete a User in Okta, a user must be DEPROVISION first | |
### | |
# DEPROVISION users by TLD email. | |
okta-cli users list -j | \ | |
jq '.[] | select(.profile.email | contains("mailinator.com")) | .id' | \ | |
xargs -I % sh -c 'echo %; okta-cli users delete --no-confirmation %' | |
# DELETE user that are DEPROVISION status | |
okta-cli users list -d -j | \ | |
jq '.[] | .id' | \ | |
xargs -I % sh -c 'echo %; okta-cli users delete --no-confirmation %' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment