Overview

Machines outside a cloud with an identity provider (bare metal, laptops in a lab, CI runners you host yourself) need some credential to log in to Prism. Instead of creating an API key and copying it over, an admin creates a short-lived invite for an existing service account. Whoever holds the invite can redeem it once, without any other credentials, to:

If the invite leaks after use, it is worthless: a second redemption is refused. Unused invites expire (24 hours by default).

  1. Create the service account and its grants

    prism service-accounts create -p payments -n build-runner
    prism stores add-grant -p payments --store ci-config \
      --principal build-runner --effect allow --role prism:store-reader
  2. Create an invite

    prism service-accounts invites create -p payments --service-account build-runner \
      -d "runner-01" --expires-in-hours 4
    # token: prism_…
    # expires_at: 2026-11-12 01:17:59

    Hand the token to whoever sets up the machine, or put it in its provisioning (for example a one-time secret in your deployment tool). Delegating this is safe: the prism:service-account-credentials-admin role can create invites without managing anything else.

  3. Register on the machine

    With the prism CLI, generating a key pair:

    prism service-accounts register --token prism_… --generate /etc/prism/build-runner.pem -d runner-01
    # subject: build-runner@service-accounts.payments.id.prism.example.com
    # public_key:
    #   version: 0
    #   algorithm: ES256
    
    prism auth sa-login --org acme --project payments \
      --service-account build-runner --private-key /etc/prism/build-runner.pem
    prism auth whoami

    Without the CLI, prism-sa-register.py needs only Python 3 and openssl (see Download). It reads the invite from PRISM_SA_INVITE_TOKEN, a file or a prompt, never from the command line, so it doesn't end up in shell history:

    PRISM_SA_INVITE_TOKEN=prism_… prism-sa-register register \
      --server https://prism.example.com --public-key
    
    # Later, whenever a token is needed:
    curl -H "Authorization: Bearer $(prism-sa-register token)" \
      https://prism.example.com/api/v1/payments/stores/ci-config/values/build%2Fnpm-token

    Run as root, the script keeps its credentials in /etc/prism/service-account; otherwise in ~/.config/prism/service-account.

  4. Or register for an API key

    prism service-accounts register --token prism_… --api-key --expires-in-days 90
    prism auth sa-login-with-apikey --api-key prism_…

Rotating and revoking

# What the service account can log in with
prism service-accounts public-keys list -p payments --service-account-id build-runner
prism service-accounts api-keys list -p payments --service-account-id build-runner

# Decommission a machine: revoke its key version, or its API key by prefix
prism service-accounts public-keys revoke -p payments --service-account-id build-runner --key-id 0
prism service-accounts api-keys revoke -p payments --service-account-id build-runner --key-id prism_32554c

# Re-key: create a new invite, register the next key version, then revoke the old one
prism service-accounts register --token prism_… --generate new.pem --version 1
prism auth sa-login --org acme --project payments --service-account build-runner \
  --private-key new.pem --key-version 1

When to use something else