Assigning a User Group to a Hub Business Vault using Powershell

Resolved

Assigning a User Group to a Hub Business Vault using Powershell

avatar

Hello All,

I am trying to assign a User Group to a Hub Business Vault using the following commands:

Get-HubVault
$psHubVault = Get-HubVault | Where-Object Name -eq "<Vault Name>" | Select-Object Name, VaultId

#Get the User Group
$group = Get-HubGroup | Where-Object Name -eq "DVLS - Application Admins"

#Get the Operators Vault Role
$contributorsRole = Get-HubVaultRole | Where-Object Name -eq "Contributors"

#Assign the Group to Operators
New-HubVaultPermission -VaultId $psHubVault.Id -GroupId $group.Id -VaultRoleId $contributorsRole.Id

The first command however () retunr an empty VaultID

Does anybody know what could be the problem / how I can solve this issue?

All Comments (6)

avatar

Good Morning,

First of all, I apologize for the delay in my response. Regarding the issue itself, it seems that I can also reproduce it here. I will open an internal ticket and investigate this problem. I will keep you informed as soon as I have an update.

Thanks

avatar

Hello @rbouwmeester ,

The Vault model does not contain a VaultId property; the correct property name is Id.
You can update your query as shown below to make it work:

$psHubVault = Get-HubVault | Where-Object Name -eq "<Vault Name>" | Select-Object Name, Id


Let me know if you have any questions.

Best regards,

avatar

Looks like Yevgeniy was faster then me :)

I can confirm that you will need to use the Id proprety to be able to use this model.

Where did you get this information (VaultId) (trying to see if we neeed to update our documentation or anything like this).

Thanks, and sorry for the double answer

avatar

Thank you both for your reply.

I am not sure where I found the information regarding the use of VaultId.

The statement $contributorsRole = Get-HubVaultRole | Where-Object Name -eq "Contributors" does not seem to return a $contributorsRole.Id. Am I using a wrong parameter there also?





avatar

Hello @rbouwmeester,

In this case the Name appears to be incorrect. To validate the data, call the function directly (don’t assign it to a variable) and display all properties. For example:

So in this case the name is "lblPermissionRoleContributors".

Best regard,

d5e319fc-45ac-486f-8019-2b5c3372ae1c.png

avatar

Hello Yevgeniy Shmygun

Thank you very much for your reply. The command works fine now. Thanks again.

Best regards,

Ron Bouwmeester