How to bulk delete termed users?

FRGRCANNONFRGRCANNON
Community Member

We are using 1Password for business. It is set up with SCIM bridge to automate provisioning. I would like to clean our users that are no longer with the company. I currently have to enter my password for each deletion. Is there a way to bulk delete termed users?


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Browser:_ Not Provided
Referrer: forum-search:Can I bulk delete termed users

Comments

  • ag_maxag_max

    Team Member

    Hi @FRGRCANNON, welcome to the 1Password Support Community. 👋

    After checking with our Integrations team, it does look like it possible to delete these suspended users in bulk. This will require some shell scripting and commands and use of the 1Password's CLI tool. You won't have to disable your auto-provisioning. For the following command, in addition to installing the 1Password Command Line Integration tool tool, we have to install a command line tool called jq that will work alongside 1Password's CLI tool. jq is a command line JSON processor which we will use to filter and action upon the output of our op command. You can learn more about jq and how to install it here. Here's a breakdown of a command you can use to do so:

    You only need to run the 5th command, however, it is highly recommended to run the 3rd and 4th commands first to verify the users that will be deleted. Get a list of all users (read only command):

    • op user list

    Get a JSON-formatted list of all users (read only command):

    • op user list --format json

    In this read-only command, we are piping the JSON output of our 2nd command into our JSON processor, jq. We are then further piping the output to filter on only the user objects that have a "SUSPENDED" state. It is highly recommended to run this command before the next command to verify that all the returned users are meant to be deleted:

    • op user list --format json | jq '.[] | select(.state =="SUSPENDED")'

    This read-only command is to double check the total number of users for deletion. Please double check that this resultant number is the correct number of suspended accounts:

    • op user list --format json | jq '.[] | select(.state =="SUSPENDED")' | jq -s length

    Final command is actioning and this is where we are further piping the output from the 3rd step back into the 1Password CLI for deletion of the SUSPENDED users.

    • op user list --format json | jq '.[] | select(.state =="SUSPENDED")' | op user delete -

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file