Set-SCACUserRole
Applies To: System Center 2012 R2 App Controller
Set-SCACUserRole
Sets a user role.
Syntax
Parameter Set: Default
Set-SCACUserRole [-UserRole] <PSObject> [[-AddMembers] <String[]> ] [[-AddScope] <ACUserRoleScope[]> ] [[-RemoveMembers] <String[]> ] [[-RemoveScope] <PSObject[]> ] [-PassThru] [ <CommonParameters>]
Detailed Description
The Set-SCACUserRole cmdlet sets a user role. You can add or remove members and scope from the user role. A new user role is not created until you set it with this cmdlet. To create a user role, use the New-SCACUserRole cmdlet.
After you have run Set-SCACuserRole on a user role or user role scope, you cannot run this cmdlet on that user role or user role scope again. To make additional updates, get the property values from the user role or user role scope by using the Get-SCACUserRole cmdlet, and then create a new user role scope with those property values and any additional changes.
Parameters
-AddMembers<String[]>
Specifies an array of members to add to the user role. You can add a user or group. Use the format domain\name.
Aliases |
none |
Required? |
false |
Position? |
2 |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-AddScope<ACUserRoleScope[]>
Specifies a user role scope object. To create a user role scope, use the New-SCACUserRoleScope cmdlet.
Aliases |
none |
Required? |
false |
Position? |
3 |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-PassThru
Returns a user role object. By default, this cmdlet does not generate output.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-RemoveMembers<String[]>
Specifies an array of members to remove from the user role. You can remove a user or group. Use the format domain\name.
Aliases |
none |
Required? |
false |
Position? |
4 |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-RemoveScope<PSObject[]>
Specifies the scope object to remove from the user role.
Aliases |
none |
Required? |
false |
Position? |
5 |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-UserRole<PSObject>
Specifies a user role object. To get a user role object, use the Get-SCACUserRole cmdlet.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters.
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
Examples
Example 1: Add members and a user role scope to a new user role
The first command creates a user role named UserRole01 and stores the user role object in the $UserRole variable.
The second command gets the Windows Azure subscription object named AzureSubscription01 and stores the object in the $AzureSubscription variable
The third command creates a user role scope with the Windows Azure subscription stored in $AzureSubscription and stores the user role scope object in the $UserRoleScope variable.
The last command adds the specified users and the user role scope stored in $UserRoleScope to the user role stored in $UserRole.
PS C:\> $UserRole = New-SCACUserRole -Name "UserRole01" -Description "First user role"
PS C:\> $AzureSubscription = Get-SCACAzureSubscription -Name "AzureSubscription01"
PS C:\> $UserRoleScope = New-SCACUserRoleScope -AzureCloud $AzureSubscription
PS C:\> Set-SCACUserRole -UserRole $UserRole -AddMembers "Contoso\ReneeLo","Contoso\NevenSokec" -AddScope $UserRoleScope
Example 2: Remove a member from an existing user role
The first command gets the user role object named UserRole01 and stores the object in the $UserRole variable.
The second command removes the specified member from the user role stored in $UserRole.
PS C:\> $UserRole = Get-SCACUserRole -Name "UserRole01" -Managed
PS C:\> Set-SCACUserRole -UserRole $UserRole -RemoveMembers "Contoso\ReneeLo"