Allow user group(s) access to vault

Resolved

Allow user group(s) access to vault

avatar

Hey,

I have developed a process that creates credentials and vaults as needed. However, when a new vault is created, I have to manually add it to the user groups that our users belong to in order for them to use it.

Is there a way to script this or automate it in some way? I've looked through the powershell functions and nothing obvious is jumping out at me.

Thanks,

Chris

All Comments (6)

avatar

Hello Chris,

You can assign a user group to a vault by using the Add-RDMRoleRepositoryAccess command. Below is an example of how to do this:

$vault = Get-RDMRepository -Name 'My vault'
$role = Get-RDMRole -Name 'My User group'
Add-RDMRoleRepositoryAccess -Repository $vault -Role $role


Should you require further assistance, please don't hesitate to reach out.

Best regards,
Maxime

avatar

That worked great! However, it looks like New-RDMRepository doesn't create a Vault that uses the default inherited permissions. I seem to have forgotten the command I can use to iterate over an object and get all its properties.

Is there a way to set the new vault to Inherit instead of Never?

Thanks,

Chris

avatar

Hello,

To set a vault's permissions to inherited, you'll need to adjust its root connection settings. First, ensure you're working within the newly created vault, then obtain the root connection by using the Get-RDMRootSession command. Here's a step-by-step example:

Get-RDMRepository -Name 'My New Vault' | Set-RDMCurrentRepository
$root = Get-RDMRootSession
$root.Security.RoleOverride = 'Default'
$root.Security.ViewOverride = 'Default'
Set-RDMRootSession -RootSession $root


If you encounter any issues or have further questions, please feel free to ask.

Best regards,
Maxime

avatar

Ahh. I had forgotten to set the Vault current before getting the Root session. Working great now!

I recall a resource that showed all the objects and their properties or a way to iterate them. Does something like that still exist?

Thanks,

Chris

avatar

Hello,

It appears you're looking for this documentation page, where two approaches are presented:

  1. Viewing properties directly from the clipboard.
  2. Using the Get-Member cmdlet to inspect objects and their properties.


If that is not the resource you are looking for, let me know and I will keep looking.

Best regards,
Maxime

avatar

Ah, that was it. I put that link at the top of my code for easier reference.

Thanks!