Repair-PAMSafePermissions
Remediates RBAC drift on a safe: brings its members + permissions back to the Harbor standard. The fix side of Compare-PAMSafePermissions.
Syntax
Section titled “Syntax”Parameter set One (default):
Repair-PAMSafePermissions [-SafeName] <string> [-RemoveUnexpected] [-DryRun] [-IgnoreMembers <string[]>] [-ConfigPath <string>] [-ConfigProfile <string>] [-WhatIf] [-Confirm]Parameter set All:
Repair-PAMSafePermissions -All [-RemoveUnexpected] [-DryRun] [-IgnoreMembers <string[]>] [-ConfigPath <string>] [-ConfigProfile <string>] [-WhatIf] [-Confirm]Description
Section titled “Description”Runs the same drift analysis as Compare-PAMSafePermissions, then converges the safe to the standard:
- ADD each expected member that is missing (resolved as a vault group first, then a CyberArk Identity role – the same way New-PAMSafe resolves members), with its standard permission set.
- UPDATE each member whose permissions drifted, setting the FULL expected set (so missing perms are added and extra perms removed at once).
- REMOVE members that are present but not part of the standard – ONLY with -RemoveUnexpected (off by default; removal is destructive). The built-in/ignored members and the connecting service user are never touched (same ignore list as Compare-PAMSafePermissions).
‘OPT’ permissions (e.g. retrieveAccounts on managed types) are never changed. Personal safes only reconcile the global admin groups (the individual owner cannot be derived from the name).
-DryRun returns the planned actions without changing anything. Otherwise each safe is gated by ShouldProcess (the web UI passes -Confirm:$false after its own confirm). A session is required – repair reads live membership.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”Repair-PAMSafePermissions -SafeName AB-PAS-SRV-WIN-DA-I-M-P -DryRunExample 2
Section titled “Example 2”Compare-PAMSafePermissions -All | Where-Object { -not $_.InCompliance }Repair-PAMSafePermissions -All -RemoveUnexpectedParameters
Section titled “Parameters”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
SwitchParameter |
Yes | Named | No |
-ConfigPath
Section titled “-ConfigPath”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | Named | No |
-ConfigProfile
Section titled “-ConfigProfile”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | Named | No |
-Confirm
Section titled “-Confirm”Asks for confirmation before the command changes anything.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
SwitchParameter |
No | Named | No |
Aliases: cf.
-DryRun
Section titled “-DryRun”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
SwitchParameter |
No | Named | No |
-IgnoreMembers
Section titled “-IgnoreMembers”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String[] |
No | Named | No |
Default: @().
-RemoveUnexpected
Section titled “-RemoveUnexpected”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
SwitchParameter |
No | Named | No |
-SafeName
Section titled “-SafeName”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
Yes | 0 | No |
-WhatIf
Section titled “-WhatIf”Shows what the command would do, without doing it.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
SwitchParameter |
No | Named | No |
Aliases: wi.
This command also accepts the PowerShell common parameters (-Verbose, -ErrorAction, and so on).
See also
Section titled “See also”- All Harbor Onboard cmdlets
- In PowerShell:
Get-Help Repair-PAMSafePermissions -Full
Covers Harbor Onboard 0.59.0 / Harbor Health 0.22.0. On an older release? Upgrading and the release notes list what changed.
