Service accounts
A service account is an identity for software, such as an application, a script or a CI job, rather than a person.
It lives in a project and is named by its email, {id}@{project}.iam-sa.cbws.xyz.
A service account is also a resource of its own. Roles granted to the account decide what it can do. Roles granted on the account decide who may act as it.
Creating a service account
Granting it access
A new service account can do nothing. Grant it a role on the project, the same way as for a user, as described in Managing access.
Authenticating as a service account
There are three ways to act as a service account. Prefer the first two, which need no long-lived secret.
On a CBWS machine
Software on a machine that runs as a service account gets tokens for it from the metadata service.
With a short-lived token
Someone with their own CBWS identity can mint a short-lived token for the account. This requires the token generator
role on the account, which add-member grants by default:
With a key
A key is a credentials file for software outside the platform.
The private key exists only in that file and cannot be fetched again. Store it as a secret, and point
CBWS_CREDENTIALS at it to run the CBWS CLI or the Go SDK as the account:
List and remove keys with:
Who may act as an account
The account's own policy decides this, see Managing access.
Deleting a service account
Warning
Deleting an account also deletes its keys, so anything still authenticating as it stops working.