For the complete documentation index, see llms.txt. This page is also available as Markdown.

Add-DSRoleAssignment

Synopsis

Assign an administrative role to one or more principals at one or more scopes.

Syntax

__AllParameterSets

Add-DSRoleAssignment -RoleID <guid> -PrincipalId <guid[]> -ScopeType <AdministrativeRoleAssignmentScopeType>
 [-ScopeID <guid[]>] [-WhatIf] [-Confirm] [<CommonParameters>]

Description

Grant a role to one or more users, user groups, or application identities at one or more scope resources. Unlike the legacy Set-DSVaultUser/-UserGroup/-Application cmdlets, this sets the scope resource ID the server requires for the assignment to take effect.

Examples

Example 1

PS C:\> $role = Get-DSAdministrativeRole | Where-Object Name -EQ 'Vault Owner'
PS C:\> Add-DSRoleAssignment -RoleID $role.Id -PrincipalId $userID -ScopeType Repository -ScopeID $vaultID

Grant the 'Vault Owner' role to a user on a specific vault.

Example 2

Grant the role to two users on two vaults in a single call (4 assignments total).

Parameters

-Confirm

Prompts for confirmation before running the cmdlet.

-PrincipalId

IDs of the users, user groups, or application identities to assign the role to.

-RoleID

ID of the role to assign.

-ScopeID

IDs of the scope resources the role is assigned on: vault IDs when -ScopeType is Repository, gateway IDs when Gateway, PAM provider IDs when PamProvider, or business unit IDs when OrganizationalUnit. Required unless -ScopeType is Global; ignored (with a warning) when -ScopeType is Global.

-ScopeType

Scope type of the assignment. Required, there is no default, to avoid silently assigning at the wrong scope.

-WhatIf

Shows what would happen if the cmdlet were to run. The cmdlet does not run.

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Notes

For more information, type "Get-Help Add-DSRoleAssignment -detailed". For technical information, type "Get-Help Add-DSRoleAssignment -full".

Last updated

Was this helpful?