New-PAMSafe
Creates one CyberArk safe to the Harbor standard: validated name, derived RBAC group membership, managing CPM, UID register entry and audit log.
Syntax
Section titled “Syntax”New-PAMSafe [-SafeType] <string> [[-App] <string>] [[-Technology] <string>] [[-SubType] <string>] [[-AccountType] <string>] [[-Environment] <string>] [[-SamAccountName] <string>] [[-Name] <string>] [[-ExceptionReason] <string>] [[-Description] <string>] [[-Owner] <string>] [[-OwnerUser] <string>] [[-CmdbRef] <string>] [[-TicketRef] <string>] [[-ManagingCpm] <string>] [[-ReserveIds] <string[]>] [[-ExpectedSafeName] <string>] [[-ExpectedUniqueId] <string>] [[-ConfigPath] <string>] [[-ConfigProfile] <string>] [-RetrieveAccounts] [-DryRun] [-SkipGroupCheck] [-NoRollback] [-WhatIf] [-Confirm]Description
Section titled “Description”Order of operations (nothing is written until every check passes):
- Build + validate the safe name from the segments (all errors at once).
- Resolve the RBAC member set for the safe type (group names derived from rbac.groupNaming.pattern; personal safes take -OwnerUser).
- Resolve the managing CPM for managed types: -ManagingCpm beats the profile’s defaultManagingCpm beats safe-defaults.json. A managed safe with no CPM is refused – it would never rotate.
- Pre-flight against the tenant: the safe must not already exist and every persona/global member must resolve – first as a vault group (memberType Group), then as a CyberArk Identity ROLE (memberType Role; Identity roles are invisible to the vault’s UserGroups API). Fails loudly listing every unresolved name; override with -SkipGroupCheck (members then use rbac.defaultMemberType).
- Create the safe, then add each member. If a member add fails the safe is deleted again (partial-create rollback; -NoRollback keeps it).
- Append the register entry (UID, owner, CMDB ref) and log the result.
-DryRun produces the full plan (steps 1-3, plus step 4 when a session is connected) without writing anything.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”New-PAMSafe -App PAS -Technology SRV -SubType WIN -AccountType DA ` -SafeType shared-managed -Environment P -Owner team@example.com -DryRunExample 2
Section titled “Example 2”New-PAMSafe -App INV -Technology DB -SubType SQL -AccountType SA ` -SafeType svc-managed -Environment T -RetrieveAccounts -CmdbRef CI-00456Example 3
Section titled “Example 3”New-PAMSafe -Name 'Legacy Finance Vault' -SafeType shared-unmanaged ` -ExceptionReason 'Pre-migration legacy estate; renaming breaks batch jobs (CHG0041)'Parameters
Section titled “Parameters”-AccountType
Section titled “-AccountType”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | 4 | No |
Shared / service safes use these 5 segments (required for those types).
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | 1 | No |
-CmdbRef
Section titled “-CmdbRef”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | 12 | No |
-ConfigPath
Section titled “-ConfigPath”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | 18 | No |
-ConfigProfile
Section titled “-ConfigProfile”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | 19 | No |
-Confirm
Section titled “-Confirm”Asks for confirmation before the command changes anything.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
SwitchParameter |
No | Named | No |
Aliases: cf.
-Description
Section titled “-Description”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | 9 | No |
-DryRun
Section titled “-DryRun”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
SwitchParameter |
No | Named | No |
-Environment
Section titled “-Environment”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | 5 | No |
-ExceptionReason
Section titled “-ExceptionReason”Mandatory justification when -Name is used; recorded in the register (who/when/why) and surfaced on reports.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | 8 | No |
-ExpectedSafeName
Section titled “-ExpectedSafeName”Tester C3: the safe name the operator PREVIEWED. A live create whose inputs now build a different name is refused before anything touches the vault.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | 16 | No |
-ExpectedUniqueId
Section titled “-ExpectedUniqueId”The UID the operator PREVIEWED (the CMDB key they may already have copied). A live create that would issue a different one is refused (409).
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | 17 | No |
-ManagingCpm
Section titled “-ManagingCpm”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | 14 | No |
GOVERNED NAMING EXCEPTION: use this raw safe name instead of building one from the segments. Explicit opt-in to bypass the naming standard – requires -ExceptionReason (audited), is mutually exclusive with the segment parameters, and is refused for personal safe types. The name must still be vault-legal (28 chars, no forbidden characters) and the policy guardrails still apply (guardrails outrank exceptions). The safe appears in the Exceptions register on every compliance report.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | 7 | No |
-NoRollback
Section titled “-NoRollback”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
SwitchParameter |
No | Named | No |
-Owner
Section titled “-Owner”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | 10 | No |
-OwnerUser
Section titled “-OwnerUser”Vault user named as the individual owner member – required for, and only used by, personal safes.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | 11 | No |
-ReserveIds
Section titled “-ReserveIds”UIDs already handed out earlier in a bulk run but not yet in the register (so a multi-row dry-run previews DISTINCT UIDs). Set by Import-PAMSafes.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String[] |
No | 15 | No |
Default: @().
-RetrieveAccounts
Section titled “-RetrieveAccounts”Resolves the ‘OPT’ retrieveAccounts permission on managed safe types. Omit it to use the rbac-map default; pass -RetrieveAccounts or -RetrieveAccounts:$false to set it explicitly.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
SwitchParameter |
No | Named | No |
-SafeType
Section titled “-SafeType”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
Yes | 0 | No |
-SamAccountName
Section titled “-SamAccountName”Personal safes use this instead (name = I-<CPM location>-<SamAccountName>); the location is derived from the chosen managing CPM.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | 6 | No |
-SkipGroupCheck
Section titled “-SkipGroupCheck”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
SwitchParameter |
No | Named | No |
-SubType
Section titled “-SubType”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | 3 | No |
-Technology
Section titled “-Technology”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | 2 | No |
-TicketRef
Section titled “-TicketRef”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | 13 | 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 New-PAMSafe -Full
Covers Harbor Onboard 0.59.0 / Harbor Health 0.22.0. On an older release? Upgrading and the release notes list what changed.
