powershell icon indicating copy to clipboard operation
powershell copied to clipboard

RoleDefinitionPipeBind: specifying RoleDefinition by Id

Open fowl2 opened this issue 2 years ago • 0 comments

Type

  • [x] New Feature

Allow specifying RoleDefinition by Id anywhere where RoleDefinitionPipeBind is used. The (presumably rare) case where the name of role definition could parse as an integer continues to work.

Example:

## Get a role definition by ID
Get-PnPRoleDefinition 1073741829

## Rename a role definition by ID
Set-PnPRoleDefinition -Identity 1073741926 -NewRoleName "100"

## Get a role definition by name
$roleDef = Get-PnPRoleDefinition "100"

## Rename a role definition by object
Set-PnPRoleDefinition $roleDef -NewRoleName "My Custom Permission Level"

fowl2 avatar Sep 09 '22 05:09 fowl2