Get a platform-managed secret value using the CLI ΒΆ

This guide shows you how to look up and retrieve the value of a platform-managed secret for one of your workloads using the Nais CLI.

Platform-managed secrets are provisioned by Nais on behalf of your workload, but may be needed for local development or debugging. They can also be seen in Nais Console in the "Instance Groups" page for your workload.

Prerequisites ΒΆ

  • nais CLI installed and authenticated
  • jq (or similar JSON tool) installed
  • Member of the Nais team that owns the workload

Steps ΒΆ

1. Find the secret name ΒΆ

List the environment variables for your workload and find the one you want, noting the secret it comes from:

shell

Tip

If you're unsure which environment variable name to use, run the command without the jq filter to see all available variables:

shell

The output is the name of the secret that contains the variable, for example:

Plaintext

2. Retrieve the secret value ΒΆ

Fetch the full contents of that secret, providing a reason for audit purposes:

shell

Replace <MY-REASON> with a short description of why you need access, such as a ticket reference or a brief explanation.

Combined ΒΆ

You can look up the secret name and retrieve its values in a single pipeline:

shell

πŸ“š About secrets