> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mistrive.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Service accounts

> Create machine identities for CI/CD pipelines and automated workflows

Service accounts are machine identities used for automated access. Unlike user accounts, service accounts authenticate using keys rather than passwords. Use them for CI/CD pipelines, build systems, and other automated workflows.

## Creating a service account

Service accounts belong to projects. Navigate to your project, then open **IAM → Service Accounts**.

<Frame>
  <img className="block dark:hidden" src="https://mintcdn.com/mistriveinc/jjSQI289HnCoAcnz/images/service-accounts-light.png?fit=max&auto=format&n=jjSQI289HnCoAcnz&q=85&s=e97f49c12538fe7a7269849c9cfbd026" alt="Mistrive Create Service Account form in light mode" width="3098" height="1752" data-path="images/service-accounts-light.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/mistriveinc/jjSQI289HnCoAcnz/images/service-accounts-dark.png?fit=max&auto=format&n=jjSQI289HnCoAcnz&q=85&s=96e859ffdee65820b01d5f19cc9e731a" alt="Mistrive Create Service Account form in dark mode" width="3098" height="1752" data-path="images/service-accounts-dark.png" />
</Frame>

<Steps>
  <Step title="Select Create Service Account">
    Open the service account creation form.
  </Step>

  <Step title="Enter service account details">
    Provide an ID (this becomes part of the service account's email-like identifier) and a display name. Optionally add a description.
  </Step>

  <Step title="Create">
    Submit the form. The new service account appears in the list.
  </Step>
</Steps>

The service account identifier follows the format:

```
{service_account_id}@{project_id}.mistriveserviceaccount.com
```

## Managing keys

Service accounts authenticate using keys. Each service account can have multiple active keys, allowing you to rotate credentials without downtime.

### Creating a key

From the service account's detail page, select **Create Key**.

<Frame>
  <img className="block dark:hidden" src="https://mintcdn.com/mistriveinc/jjSQI289HnCoAcnz/images/manage-keys-light.png?fit=max&auto=format&n=jjSQI289HnCoAcnz&q=85&s=bdce54ac63c78f502a21f80bda3d397f" alt="Mistrive Create Service Account Key form in light mode" width="3098" height="1752" data-path="images/manage-keys-light.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/mistriveinc/jjSQI289HnCoAcnz/images/manage-keys-dark.png?fit=max&auto=format&n=jjSQI289HnCoAcnz&q=85&s=cf90fc195a2f7319069f1189235ac629" alt="Mistrive Create Service Account Key form in dark mode" width="3098" height="1752" data-path="images/manage-keys-dark.png" />
</Frame>

<Steps>
  <Step title="Create the key">
    The system generates a new key pair and displays the credentials.
  </Step>

  <Step title="Download the JSON">
    Download the key file immediately. This is the only time the private key is available.
  </Step>
</Steps>

<Frame>
  <img className="block dark:hidden" src="https://mintcdn.com/mistriveinc/jjSQI289HnCoAcnz/images/key-json-light.png?fit=max&auto=format&n=jjSQI289HnCoAcnz&q=85&s=e3cb8c7e870f001b29ad11739383c554" alt="Mistrive Download Service Account Key in light mode" width="3098" height="2098" data-path="images/key-json-light.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/mistriveinc/jjSQI289HnCoAcnz/images/key-json-dark.png?fit=max&auto=format&n=jjSQI289HnCoAcnz&q=85&s=c6209def4386be744c20b0bf2ebfe00a" alt="Mistrive Download Service Account Key in dark mode" width="3098" height="2098" data-path="images/key-json-dark.png" />
</Frame>

<Warning>
  Store the key file securely. If you lose it, you'll need to create a new key—there's no way to recover the private key.
</Warning>

The downloaded JSON file contains everything needed to authenticate:

```json theme={null}
{
  "type": "service_account",
  "project_id": "my-project",
  "service_account_id": "ci-pipeline",
  "private_key_id": "abc123...",
  "private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
}
```

### Deleting a key

To revoke a key, navigate to the service account and delete the specific key from the keys list. Any systems using that key will immediately lose access.

<Tip>
  Before deleting an old key, ensure all systems have been updated to use a new key. This prevents service disruptions during key rotation.
</Tip>

## Granting access

A newly created service account has no permissions. Grant access by adding it to project IAM or repository permissions.

### Project-level access

Add the service account to the project's IAM with appropriate roles. Navigate to **IAM** in your project, then add the service account identifier as a principal.

Common configurations:

| Use case             | Recommended role      |
| -------------------- | --------------------- |
| Pull images only     | Artifact Store Viewer |
| Push and pull images | Artifact Store Editor |
| Manage repositories  | Artifact Store Owner  |
| Full project access  | Editor or Owner       |

### Repository-level access

For fine-grained control, grant access to specific repositories instead of the entire project. See [Managing repository permissions](/user-guides/artifact-store#managing-permissions) for details.

## What's next

With your service account configured:

1. [Set up Docker authentication](/user-guides/docker-authentication) to use the service account key
2. [Configure repository access](/user-guides/artifact-store#managing-permissions) for specific registries
