Skip to content

Service account & secret sources

Harbor suiteRole: adminDescribes Onboard 0.58.0 / Health 0.21.0

The service account is a console’s own vault identity. It is what scheduled scans, Harbor Health’s automatic scans and fleet view, and any operator without a vault session of their own use to reach CyberArk. Each profile declares it explicitly: which account, the one place its secret comes from, and whether the console connects it at start.

Threat Control
A secret read from an unexpected place (a stray environment variable in one shell, an old file) Harbor reads only the declared source. There is no fallback chain.
Someone with a low role making the console connect, or making their own logon everyone’s identity Signing in never connects the service account. Connecting and changing it are admin-only, and a change needs an identity re-check.
A secret remembered without anyone deciding to store it A secret typed in the Connect form is used for that connection only. Storing one is its own admin action.
A secret sent to the wrong host Moving the tenant to another host removes the stored secret and ends the service session.
The secret in the configuration file The file holds only a reference: the name of a variable or a vault secret, or a DPAPI blob only this Windows account can decrypt.
"serviceAccount": {
"kind": "oauth",
"clientId": "[email protected]",
"secretSource": "secretManagement",
"connect": "startup"
}
Field Values
kind oauth: an OAuth2 client-credentials service user (recommended). Or a vault user that logs on with a password: cyberark, ldap, radius or windows.
clientId For oauth. Defaults to the profile’s oauthClientId.
username For the vault-user kinds. Defaults to the profile’s username. Without one, the operator types the name in the Connect form.
secretSource dpapi, secretManagement, env or prompt (see below).
envVar For env. Defaults to HARBOR_OAUTH_SECRET (oauth) or HARBOR_LOGON_PASSWORD (the vault-user kinds).
connect startup: the console connects before it opens its port. manual (default): an admin connects it. startup needs a stored source; a console can never prompt.

A demo profile has no service account: it uses the sample vault.

Source Where the secret lives Good for
secretManagement A Microsoft.PowerShell.SecretManagement vault, named in the profile’s secretManagement { vault, secret } block. Recommended, especially for SYSTEM services.
dpapi A blob in the profile (oauthClientSecretDpapi / logonPasswordDpapi), encrypted with DPAPI for the Windows account that stored it. A console that always runs as one known account.
env An environment variable of the account that runs Harbor. Automation that already injects secrets per process. Never machine-wide.
prompt Nowhere: typed at Connect each time. Occasional use; connect must be manual.

A secret passed to the call itself always wins: Connect-PAMSession -ClientSecret or -Password on the command line, or a secret typed in the Connect form when the source is prompt.

Gear menu, Tenant & service account, card Service account (this console’s own vault identity). The card summarises what is declared, then:

Field Shown for
Kind always
OAuth client id oauth
Vault user the vault-user kinds
Secret comes from: Stored on this machine (DPAPI, this Windows account), A SecretManagement vault, An environment variable, Typed at Connect (never stored) always
Secret DPAPI: the secret to store (leave empty to keep the one already stored)
SecretManagement secret, Vault SecretManagement
Environment variable environment variable
Connect: Manually (an admin presses Connect) or When the console starts always

Select Save service account. Remove (after a confirmation) deletes the declaration and its stored secret, and ends the service session on both consoles; SSO operators keep their own sessions.

For safety, the console accepts only Harbor’s own variable names (HARBOR_OAUTH_SECRET, HARBOR_LOGON_PASSWORD, or a name starting HARBOR_SVC_) and SecretManagement secret names starting with Harbor. Use PowerShell for anything else.

Terminal window
# OAuth service user, secret in a SecretManagement vault, connect at start
Set-HarborServiceAccount -Kind oauth -ClientId <client id> -SecretSource secretManagement -SecretName <secret name> -Vault <vault name> -Connect startup
# OAuth service user, secret stored with DPAPI for this Windows account
Set-HarborServiceAccount -Kind oauth -ClientId <client id> -SecretSource dpapi -Secret (Read-Host -AsSecureString) -Connect startup
# A vault user whose password comes from this account's environment
Set-HarborServiceAccount -Kind cyberark -Username <name> -SecretSource env -EnvVar HARBOR_LOGON_PASSWORD -Connect startup
# Remove it
Set-HarborServiceAccount -Remove

With -SecretSource dpapi and no -Secret, the secret already stored is kept. Set-HarborSecretVault still works but is deprecated: use Set-HarborServiceAccount -SecretSource secretManagement.

A console running as SYSTEM (see Run as a Windows service) cannot decrypt a DPAPI blob stored by your account, and does not see your shell’s variables. Use a SecretManagement vault SYSTEM can open, a DPAPI blob saved from the SYSTEM account, or connect: manual.

A profile without a serviceAccount block is read as the equivalent declaration, and the web console writes it into the profile at its first start. The source is chosen durable-first: SecretManagement, then a stored DPAPI blob, then the environment variable, then prompt. Details and the one case that needs action: Upgrading.

Give the service account only what your use needs:

  • Harbor Onboard: create and manage safes, safe members and accounts; read Identity roles if your persona groups are Identity roles.
  • Harbor Health: administrator-grade rights for the system health APIs.

Test-HarborSetup -Connect (or Setup Doctor) checks that the token works, that the global admin groups resolve, and that Identity roles can be read.

  • After a tenant move, the stored DPAPI secret is removed, but an admin can still declare an env or SecretManagement source straight away, and so send that secret to the new host. It takes a deliberate admin action and is audited twice; check the declared source after moving a tenant.

See Known limitations.

Covers Harbor Onboard 0.59.0 / Harbor Health 0.22.0. On an older release? Upgrading and the release notes list what changed.