Skip to content

Commit

Permalink
Set-TssSecretPolicy - new command
Browse files Browse the repository at this point in the history
partial as some policy items are excluded
  • Loading branch information
wsmelton committed Aug 9, 2021
1 parent 2d05656 commit e31b1e2
Show file tree
Hide file tree
Showing 7 changed files with 584 additions and 8 deletions.
243 changes: 243 additions & 0 deletions docs/commands/secret-policies/Set-TssSecretPolicy.md
@@ -0,0 +1,243 @@
# Set-TssSecretPolicy

## SYNOPSIS
Set a Secret Policy property

## SYNTAX

### policy (Default)
```
Set-TssSecretPolicy [-TssSession] <Session> -Id <Int32> [-Name <String>] [-Description <String>] [-Active]
[-WhatIf] [-Confirm] [<CommonParameters>]
```

### item
```
Set-TssSecretPolicy [-TssSession] <Session> -Id <Int32> [-ItemName <SecretPolicyItem>]
[-ItemType <SecretPolicyType>] [-ItemApplyType <SecretPolicyApplyType>] [-ItemValue <Object>]
[-UserGroupMap <Object>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION
Set a Secret Policy property

## EXAMPLES

### EXAMPLE 1
```
$session = New-TssSession -SecretServer https://alpha -Credential ssCred
Set-TssSecretPolicy -TssSession $session -Id 52 -Active:$false
```

Set Secret Policy ID 52 to inactive, changing Active property to false

### EXAMPLE 2
```
$session = New-TssSession -SecretServer https://alpha -Credential ssCred
Set-TssSecretPolicy -TssSession $session -Id 52 -Active -Name 'Set Auto Change Enabled'
```

Set Secret Policy ID 52 to active and change the name

## PARAMETERS

### -TssSession
TssSession object created by New-TssSession for authentication

```yaml
Type: Session
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```

### -Id
Secret Policy ID

```yaml
Type: Int32
Parameter Sets: (All)
Aliases: SecretPolicyId

Required: True
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```

### -Name
Secret Policy Name

```yaml
Type: String
Parameter Sets: policy
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Description
Secret Policy Description

```yaml
Type: String
Parameter Sets: policy
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Active
Secret Policy Active or Inactive

```yaml
Type: SwitchParameter
Parameter Sets: policy
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```

### -ItemName
Secret Policy Item Name

```yaml
Type: SecretPolicyItem
Parameter Sets: item
Aliases:
Accepted values: AutoChangeOnExpiration, HeartBeatEnabled, SiteId, PrivilegedSecretId, AssociatedSecretId1, AutoChangeSchedule, PasswordTypeWebScriptId, CheckOutEnabled, CheckOutIntervalMinutes, CheckOutChangePassword, RequireApprovalForAccess, RequireApprovalForAccessForOwnersAndApprovers, RequireApprovalForAccessForEditors, RequireViewComment, IsSessionRecordingEnabled, HideLauncherPassword, ApprovalGroup, AssociatedSecretId2, IsProxyEnabled, EnableSshCommandRestrictions, SshCommandMenuGroups, AllowOwnersUnrestrictedSshCommands, ApprovalWorkflow, EventPipelinePolicy, RunLauncherUsingSSHKey, WebLauncherRequiresIncognitoMode, SshCommandRestrictionType, SshCommandBlocklistOwners, SshCommandBlocklistEditors, SshCommandBlocklistViewers

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ItemType
Secret Policy Item Type

```yaml
Type: SecretPolicyType
Parameter Sets: item
Aliases:
Accepted values: Bool, Int, SecretId, Group, Schedule, SshMenuGroup, SshBlocklist

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ItemApplyType
Secret Policy Item Apply Type (NotSet, Default, Enforced)

```yaml
Type: SecretPolicyApplyType
Parameter Sets: item
Aliases:
Accepted values: NotSet, Default, Enforced

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ItemValue
Secret Policy Item Value (based on ItemType what object you have to pass in)

```yaml
Type: Object
Parameter Sets: item
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -UserGroupMap
User and Group Mapping, hashtable of UserGroupId and UserGroupMapType (User or Group)

```yaml
Type: Object
Parameter Sets: item
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Confirm
Prompts you for confirmation before running the cmdlet.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

## OUTPUTS

## NOTES
Requires TssSession object returned by New-TssSession

## RELATED LINKS

[https://thycotic-ps.github.io/thycotic.secretserver/commands/secret-policies/Set-TssSecretPolicy](https://thycotic-ps.github.io/thycotic.secretserver/commands/secret-policies/Set-TssSecretPolicy)

[https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/secret-policies/Set-TssSecretPolicy.ps1](https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/secret-policies/Set-TssSecretPolicy.ps1)

62 changes: 62 additions & 0 deletions src/Thycotic.SecretServer.Format.ps1xml
Expand Up @@ -1693,6 +1693,68 @@
</TableControl>
</View>

<!-- Thycotic.PowerShell.SecretPolicies.PolicyItem -->
<View>
<Name>SecretPolicies.PolicyItem</Name>
<ViewSelectedBy>
<TypeName>Thycotic.PowerShell.SecretPolicies.PolicyItem</TypeName>
</ViewSelectedBy>
<TableControl>
<TableHeaders>
<TableColumnHeader />
<TableColumnHeader />
<TableColumnHeader />
<TableColumnHeader />
<TableColumnHeader />
<TableColumnHeader />
<TableColumnHeader />
<TableColumnHeader />
<TableColumnHeader />
<TableColumnHeader />
<TableColumnHeader />
</TableHeaders>
<TableRowEntries>
<TableRowEntry>
<TableColumnItems>
<TableColumnItem>
<PropertyName>ParentSecretPolicyItemId</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>SecretPolicyItemId</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>Name</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>PolicyApplyType</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>ValueType</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>ValueBool</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>ValueInt</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>ValueString</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>ValueSecretId</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>UserGroupMaps</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>SshCommandMenuGroupMaps</PropertyName>
</TableColumnItem>
</TableColumnItems>
</TableRowEntry>
</TableRowEntries>
</TableControl>
</View>

<!-- TssSecretHookSummary -->
<View>
<Name>SecretHookSummary</Name>
Expand Down
11 changes: 5 additions & 6 deletions src/Thycotic.SecretServer.psd1
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Shawn Melton
#
# Generated on: 8/5/2021
# Generated on: 8/9/2021
#

@{
Expand Down Expand Up @@ -124,17 +124,16 @@ FunctionsToExport = 'Add-TssEventPipeline', 'Add-TssFolderPermission',
'Search-TssSecretPolicy', 'Search-TssSecretTemplate',
'Search-TssUser', 'Search-TssWorkflowTemplate', 'Set-TssFolder',
'Set-TssSecret', 'Set-TssSecretExpiration', 'Set-TssSecretField',
'Set-TssSecretRpcAssociated', 'Set-TssSecretRpcPrivileged',
'Set-TssSecretSecurity', 'Set-TssSecretTemplate',
'Show-TssCurrentUser', 'Start-TssDiscovery',
'Set-TssSecretPolicy', 'Set-TssSecretRpcAssociated',
'Set-TssSecretRpcPrivileged', 'Set-TssSecretSecurity',
'Set-TssSecretTemplate', 'Show-TssCurrentUser', 'Start-TssDiscovery',
'Start-TssSecretChangePassword', 'Start-TssSecretDependency',
'Start-TssSecretHeartbeat', 'Stop-TssSecretChangePassword',
'Test-TssFolderAction', 'Test-TssSdkClient', 'Test-TssSecretAction',
'Test-TssSecretState', 'Test-TssVersion', 'Unlock-TssUser',
'Update-TssFolder', 'Update-TssFolderPermission',
'Update-TssGroupMember', 'Update-TssSecret', 'Update-TssSecretHook',
'Update-TssSecretPermission', 'Update-TssSecretPolicy',
'Update-TssSecretRdpLauncherSetting',
'Update-TssSecretPermission', 'Update-TssSecretRdpLauncherSetting',
'Update-TssSecretTemplateField', 'Update-TssUser',
'Update-TssUserPassword', 'Write-TssSecretAccessRequestViewComment'

Expand Down
Expand Up @@ -16,11 +16,11 @@ public class PolicyItem
public int SecretPolicyItemMapId { get; set; }
public string SectionName { get; set; }
public SshCommandMenuGroupMap[] SshCommandMenuGroupMaps { get; set; }
public UserGroupMap UserGroupMaps { get; set; }
public UserGroupMap[] UserGroupMaps { get; set; }
public bool ValueBool { get; set; }
public int ValueInt { get; set; }
public int ValueSecretId { get; set; }
public string ValueString { get; set; }
public SecretPolicyType valueType { get; set; }
public SecretPolicyType ValueType { get; set; }
}
}

0 comments on commit e31b1e2

Please sign in to comment.