Dynamic Secrets

This feature is currently available only to customers participating in a Private Preview. If you'd like to participate and be among the first to try this feature, ask our support or account team for details.

A dynamic secret creates a new, short-lived credential each time you mint one from it, and removes the credential when its lease ends. Instead of sharing one long-lived database password or Azure client secret, each pipeline run or application instance gets its own credential that stops working shortly after the job is done.

Workload Secrets Vault can create credentials for these targets:

How Dynamic Secrets Work

A dynamic secret uses two secrets:

  • The base secret holds an administrator credential for the target and says where the target is. Only administrators should be able to read it.

  • The dynamic secret points to the base secret and describes the credential to create: what it can do and how long it lasts. Pipelines and applications mint credentials from this secret.

When a caller mints a credential from the dynamic secret:

  1. Workload Secrets Vault opens a lease and sends the request to a Delinea Platform engine at your site.

  2. The engine uses the administrator credential to create a new account or client secret on the target.

  3. The response returns the new credential, the lease ID, and the time the lease expires.

  4. After the lease expires, Workload Secrets Vault has the engine remove the credential.

The administrator credential travels only between Workload Secrets Vault and your engine. It's never returned to the caller of the dynamic secret.

Prerequisites

  • A Delinea Platform engine with the Workload Secrets Vault capability. Every dynamic secret, including Azure, is created and removed through an engine in your environment. Install an engine at a site that can reach the target, and add the Workload Secrets Vault capability to it. After you add it, the engine's Workloads tab lists the Workload Secrets Vault workload. See Platform Engine Management. You can run more than one engine at a site. Mints need an up-to-date engine: if a mint returns 409 transit_incompatible_engine_version, update the engine.

  • The site ID. The base secret names the engine site by its ID. A database base secret needs it: the service accepts a database base secret without a site ID, but every mint from it then fails with 400 secret_target_type_invalid. For Azure, the site ID is optional.

  • An administrator credential for the target with the rights to create and remove accounts. Each target topic lists the rights it needs.

  • A service user for the REST API. The CLI can't write base and dynamic secrets, so you write them through the REST API with a Delinea Platform service user's access token. See Authenticating to the API.

  • Permissions and policies. See Who Can Create Dynamic Secrets and Mint Credentials.

Creating a Dynamic Secret

  1. Write the base secret to an administrator-only path, for example dynamic/base/orders-mysql, by sending its definition to POST /api/v1/secrets/base/{path}. The fields depend on the target.

  2. Write the dynamic secret to the path that pipelines will mint from, for example payments/prod/orders-db-read, by sending its definition to POST /api/v1/secrets/dynamic/{path}. Point it to the base secret with baseSecretPath.

  3. Mint a credential once to test it. Some problems show up only when you mint, such as a database base secret without a site ID, a wrong administrator password, or an engine that can't reach the target.

In both requests, the body is the definition itself, with no data wrapper. Each target topic has examples. The CLI can't send these requests, because secret base create and secret dynamic create have no flags for the target-specific fields, such as connection and access. You can still mint credentials and manage leases with the CLI.

secret create always stores a static secret, even when the data looks like a definition, and a static secret can't mint. A path keeps the kind of secret it was created with: writing a base, dynamic, or static secret to a path that holds another kind returns 409 secret_kind_immutable.

Workload Secrets Vault checks each definition when you write it, and refuses one it can't mint from with 400:

  • secret_base_definition_invalid: a base secret breaks a rule, for example an unsupported targetType or a port outside 1 to 65535.

  • secret_definition_invalid: a dynamic secret doesn't fit its base secret. For example, baseSecretPath doesn't name a base secret, type doesn't match the base secret's target, ttlSeconds is out of range, or access doesn't fit the database.

  • request_validation_failed: the body has a field that its type doesn't define, or a value that can't be read, such as "level": "Read".

The first two name the field at fault.

A base secret's type, and a database base secret's targetType, can't change after you create the base secret. A write or rollback that changes either returns 409 secret_target_type_immutable.

To change anything else in a base secret, for example to rotate the administrator password or to move the target to another host, port, or site, send the base secret again to the same path with the complete definition. Each write stores a new version, and later mints and credential removals use the current version. Database credentials that were already minted are still removed through the site, host, and port they were minted with. To change a dynamic secret, send it again to its path in the same way.

The fields of a dynamic secret are:

Field Description
type Required. database for a database base secret. For an Azure base secret, azureEphemeral to create a temporary service principal, or azureExistingApp to add a client secret to an app registration you already have.
baseSecretPath Required. The path of the base secret.
ttlSeconds How long each credential lasts, in seconds, as a whole number. From 60 (1 minute) to 28800 (8 hours). The default is 900 (15 minutes).
Target-specific fields access for database, which is required. scope and roleDefinitionId for azureEphemeral. appObjectId for azureExistingApp. Each type accepts only its own fields.

Minting a Credential

To get a credential, mint one from the dynamic secret:

Copy
delinea --json workload secret mint payments/prod/orders-db-read

The REST equivalent is POST /api/v1/secrets/mint/{path}, with no request body. There's no version argument: a mint always uses the dynamic secret's current version.

The response holds the lease and the new credential:

Copy
{
  "data": {
    "leaseId": "862f1d20-35ae-4518-9539-0b07c975f8c0",
    "expiresAt": "2026-11-05T18:21:23.8904094+00:00",
    "credential": {
      "type": "database",
      "username": "mint_e61e896fdb7",
      "password": "Wm9y8kJ0cX1vR2t6aGJ3eUlxQ2xNcE9h"
    }
  }
}

expiresAt is when the lease ends, in UTC. An Azure credential has "type": "azure" and holds tenantId, clientId, and clientSecret instead of username and password. The credential's values are returned only once, and Workload Secrets Vault doesn't store them.

In a script, read the values with jq:

Copy
delinea --json workload secret mint payments/prod/orders-db-read > cred.json
DB_USER=$(jq -r '.data.credential.username' cred.json)
DB_PASSWORD=$(jq -r '.data.credential.password' cred.json)
LEASE_ID=$(jq -r '.data.leaseId' cred.json)
LEASE_EXPIRES=$(jq -r '.data.expiresAt' cred.json)
rm cred.json

Every successful mint creates a new credential with its own lease. Keep these points in mind:

  • Don't retry mints automatically. If a mint fails with a 502 or 504, a credential might have been created anyway, and a retry creates another one. Retry only when the response is 503 with a Retry-After header.

  • Mint once per job. Store the credential in memory for the job's duration rather than minting again for each connection.

  • A mint waits for the engine for a limited time. The engine has 10 seconds to create a database credential and 30 seconds to create an Azure credential. After that, the mint returns 504 transit_mint_timed_out.

  • secret get doesn't mint. Reading a dynamic secret with secret get (GET /api/v1/secrets/data/{path}) returns 409 secret_mint_required.

  • To inspect a dynamic secret without minting, run secret describe. It shows the definition only if you can also read the base secret; otherwise, the response leaves out the whole definition. It never shows the base secret's contents.

  • Only the current version mints. If the current version of a dynamic secret is deleted or destroyed, a mint returns 404.

Leases and Revocation

Each mint opens a lease. The mint response has its ID at .data.leaseId.

  • Each credential's lease ends at the time shown in expiresAt. Shortly after that, Workload Secrets Vault has an engine at the same site remove the credential. In testing, removal finished within about two minutes of expiry.

  • Database accounts keep working until they're removed. Azure client secrets also stop working at the expiry time, even before they're removed.

  • If the engine or target can't be reached, Workload Secrets Vault keeps retrying the removal, waiting longer between attempts, up to 15 minutes apart.

  • You can't renew a lease. To remove a credential before its lease ends, revoke the lease early.

A lease's status is pending until the engine confirms that it created the credential, active while the credential exists, and revoked once the credential is removed. A lease stays active after expiresAt until the removal finishes. For the permissions and policy actions that the lease commands need, see Who Can Create Dynamic Secrets and Mint Credentials.

Listing Leases

List the leases minted from a dynamic secret, newest first:

Copy
delinea --json workload lease list --dynamic-secret-path payments/prod/orders-db-read

The REST equivalent is GET /api/v1/leases?dynamicSecretPath=payments/prod/orders-db-read. The path must be the dynamic secret's exact path, and the list doesn't include the leases of dynamic secrets under it.

  • To list only the leases in one status, add --status (status) with pending, active, or revoked.

  • To page through the leases, use --limit (limit), the most leases to return, from 1 to 100 with a default of 50, and --offset (offset), the number of leases to skip, with a default of 0.

A list without a dynamic secret path, or with a value that isn't allowed, returns 400 lease_invalid_request.

Looking Up a Lease

Copy
delinea --json workload lease get 862f1d20-35ae-4518-9539-0b07c975f8c0

The REST equivalent is GET /api/v1/leases/{id}. A lease shows its id, dynamicSecretPath, username, status, createdAt, and expiresAt, and, once they apply, when, why, and by whom it was revoked. It never shows the credential's password or client secret.

Revoking a Lease Early

Copy
delinea --json workload lease revoke 862f1d20-35ae-4518-9539-0b07c975f8c0

The REST equivalent is POST /api/v1/leases/{id}/revoke. The revoke is queued, and the call returns 202. To wait for the credential to be removed, add --sync (?sync=true): the call returns 200 once the credential is gone, or 202 if the removal is still running when the wait ends. Revoking a lease that's already revoked returns 200.

Only an active lease can be revoked early. A pending lease returns 409 lease_not_active, because its mint might still be running.

Removal uses the administrator credential in the base secret. While leases are open, don't store a wrong password in the base secret: Workload Secrets Vault can't remove the outstanding credentials until the base secret works again. When you rotate the administrator password, write the new password to the base secret as soon as the change takes effect on the target.

While leases minted from a base secret are pending or active, you can't delete or destroy the base secret's current version or purge the base secret: the request returns 409 secret_base_secret_in_use. Revoke the leases or wait for them to end, and then try again.

Who Can Create Dynamic Secrets and Mint Credentials

Task Permission Policy
Write a base secret Create Secret create on the base secret's path
Write a dynamic secret Create Secret create on the dynamic secret's path and read on the base secret's path
Roll back or restore a dynamic secret Update Secret update or restore on the dynamic secret's path and read on the base secret's path
Mint a credential Read Secret read on the dynamic secret's path. No access to the base secret is needed.
List a dynamic secret's leases Read Secret list on lease/<dynamic-secret-path>/, with the trailing slash
Look up a lease Read Secret read on lease/<dynamic-secret-path>/<lease-id>
Revoke a lease early Delete Secret revoke on lease/<dynamic-secret-path>/<lease-id>

A lease's policy target is lease/<dynamic-secret-path>/<lease-id>, with the lease/ resource type. A target such as lease/payments/prod/orders-db-read/* with the actions list, read, and revoke covers listing, looking up, and revoking that dynamic secret's leases. See Targets.

Anyone who can read a base secret can see the administrator credential in it. Keep base secrets on paths that only administrators can read, separate from the dynamic secrets that pipelines mint from.

Errors

Status Error code Cause and action
400 request_validation_failed The request body has a field that its type doesn't define, or a value that can't be read, such as "level": "Read".
400 secret_base_definition_invalid The base secret you wrote breaks a rule, for example an unsupported targetType, a port outside 1 to 65535, no database for SQL Server or PostgreSQL, or an authMechanism other than usernamePassword. The response names the field.
400 secret_definition_invalid The dynamic secret doesn't fit its base secret: baseSecretPath doesn't name a base secret, type doesn't match the base secret's target, ttlSeconds isn't from 60 to 28800, or access doesn't fit the database. A mint can also return it, because grants are checked again at each mint. The response names the field.
400 secret_ttl_invalid The dynamic secret's ttlSeconds was outside the allowed range when you minted. A value out of range when you write the dynamic secret returns secret_definition_invalid instead.
400 secret_target_type_invalid There's no engine site to mint through: a database base secret has no site ID, or an Azure base secret has no site ID and your tenant has no engine site. Name the engine's site in the base secret's siteId.
400 secret_auth_mechanism_unavailable The base secret's authMechanism isn't available on this service.
400 lease_invalid_request A lease list has no dynamic secret path, a status other than pending, active, or revoked, a limit outside 1 to 100, or a negative offset.
404 secret_not_found The dynamic secret or its base secret doesn't exist, or the link to it is invalid.
404 lease_not_found No lease has that ID.
409 secret_mint_required You read a dynamic secret with secret get. Mint a credential with secret mint instead.
409 secret_not_dynamic You tried to mint from a path that holds a static secret or a base secret.
409 secret_kind_immutable The path already holds another kind of secret. A path keeps the kind it was created with: static, base, or dynamic.
409 secret_base_secret_in_use You tried to delete or destroy a base secret's current version, or purge the base secret, while leases minted from it are pending or active. Revoke the leases or wait for them to end.
409 secret_target_type_immutable A write or rollback would change a base secret's type or targetType, which can't change.
409 transit_incompatible_engine_version The engine is too old. Update the engine.
409 lease_not_active You tried to revoke a pending lease. Its mint might still be running, so it can't be revoked yet.
409 lease_concurrent_modification The lease changed while the revoke was being recorded. Send the revoke again.
502 transit_engine_error, transit_bus_unavailable, transit_site_lookup_failed The engine couldn't create the credential or couldn't be reached. Check the engine's logs and its connection to the target. Don't retry automatically.
503 transit_no_engine_available No engine at the site answered. Check that an engine with the Workload Secrets Vault capability is running at the site.
503 mint_capacity_exceeded Too many credentials are being created at once. No credential was created. Retry after the Retry-After interval.
504 transit_mint_timed_out The engine didn't answer within 10 seconds for a database credential, or 30 seconds for an Azure credential. A credential might still have been created; it's removed automatically. Don't retry automatically.

The engine writes a log entry for each credential it creates or removes, with the lease ID, target, and account name, but never the password. Check the engine's logs on its host when a mint fails.