Updating Group Permissions on Multiple Vaults

Options
NateC
NateC
Community Member
edited November 2022 in CLI

I am looking for sort of command or process that I can use to change the permissions on multiple vaults (70+) for a group of users without having to go through each vault one by one.

I have had a skim through the 1Password CLI documentation but I can't quite figure it out.

Thanks!


1Password Version: 8.9.8
Extension Version: Not Provided
OS Version: Not Provided
Browser:_ Not Provided

Comments

  • Hello @NateC, If you already have a list of vaults you want to set permissions to a group, we can use 1Password CLI and some help from jq to edit permissions for multiple vaults

    If interested, you can go here to get the latest version of jq.

    After that, we can try this commands to edit vault permissions for your group.

    op vault list --format json | jq '.[].id' | Sed 's/"//g' > file.txt This command will list all vaults and get their IDs, then it will strip double quotes wrap around IDs and send it to file.txt

    We can then use while loop to read each line in our file.txt and set permission for vaults on the list.

    cat file.txt | while read i; do op vault group grant --group <name or id of the group> --vault $i --permissions <permissions>; done.

    After setting permissions, we can remove the fle.txt that has the IDs of our vaults.

    However, if you want, we can run all commands in one line without creating a file.txt like this.

    op vault list --format json | \
     jq '.[].id' | Sed 's/"//g' | \
    while read i; do op vault group grant --group <name or id of the group> --vault $i --permissions <permissions>; done
    

    Thank you.

This discussion has been closed.