Onboarding Machines with Service Account Invites
Give a server, build agent or on-premises job a Prism identity without handing it an admin-created secret: issue a single-use invite, and let the machine register its own key pair.
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:
- register a public key: the machine generates an EC P-256 key pair and the private key never leaves it; it later logs in with a self-signed JWT; or
- get an API key created by Prism, when a key pair is impractical.
If the invite leaks after use, it is worthless: a second redemption is refused. Unused invites expire (24 hours by default).
-
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 -
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:59Hand 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-adminrole can create invites without managing anything else. -
Register on the machine
With the
prismCLI, 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 whoamiWithout the CLI,
prism-sa-register.pyneeds only Python 3 andopenssl(see Download). It reads the invite fromPRISM_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-tokenRun as root, the script keeps its credentials in
/etc/prism/service-account; otherwise in~/.config/prism/service-account. -
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
- On EC2, use the instance profile instead: EC2 Host Identity.
- In GitHub Actions, use OIDC: Keyless CI with GitHub Actions.
- For workloads with their own OIDC issuer (another Prism organization, Kubernetes, …), use an OpenID trust.