> [!CAUTION]
> You are currently viewing version 1.4 of the Apigee hybrid documentation. **This version is end of life.** You should upgrade to a newer version. For more information, see [Supported versions](https://docs.cloud.google.com/apigee/docs/hybrid/supported-platforms.md.txt#supported-versions).

<button class="button button-with-icon cloud-select-dropdown__button button-primary" aria-haspopup="true">Version 1.4 (unsupported)</button>

- Supported versions:
- [v1.17 (latest)](https://docs.cloud.google.com/apigee/docs/hybrid/v1.17/create-service-account.md.txt)
- [v1.16](https://docs.cloud.google.com/apigee/docs/hybrid/v1.16/create-service-account.md.txt)
- [v1.15](https://docs.cloud.google.com/apigee/docs/hybrid/v1.15/create-service-account.md.txt)
- [v1.14](https://docs.cloud.google.com/apigee/docs/hybrid/v1.14/create-service-account.md.txt)
- [List of supported versions](https://docs.cloud.google.com/apigee/docs/hybrid/supported-platforms.md.txt#supported-versions)
- Unsupported versions:
- [v1.13](https://docs.cloud.google.com/apigee/docs/hybrid/v1.13/create-service-account.md.txt)
- [v1.12](https://docs.cloud.google.com/apigee/docs/hybrid/v1.12/create-service-account.md.txt)
- [v1.11](https://docs.cloud.google.com/apigee/docs/hybrid/v1.11/create-service-account.md.txt)
- [v1.10](https://docs.cloud.google.com/apigee/docs/hybrid/v1.10/create-service-account.md.txt)
- [v1.9](https://docs.cloud.google.com/apigee/docs/hybrid/v1.9/create-service-account.md.txt)
- [v1.8](https://docs.cloud.google.com/apigee/docs/hybrid/v1.8/create-service-account.md.txt)
- [v1.7](https://docs.cloud.google.com/apigee/docs/hybrid/v1.7/create-service-account.md.txt)
- [v1.6](https://docs.cloud.google.com/apigee/docs/hybrid/v1.6/create-service-account.md.txt)
- [v1.5](https://docs.cloud.google.com/apigee/docs/hybrid/v1.5/create-service-account.md.txt)
- [v1.4](https://docs.cloud.google.com/apigee/docs/hybrid/v1.4/create-service-account.md.txt)
- [v1.3](https://docs.cloud.google.com/apigee/docs/hybrid/v1.3/create-service-account.md.txt)
- [v1.2](https://docs.cloud.google.com/apigee/docs/hybrid/v1.2/create-service-account.md.txt)
- [v1.1](https://docs.cloud.google.com/apigee/docs/hybrid/v1.1/create-service-account.html)

Creates Google Cloud Platform service accounts with roles that allow
individual Apigee hybrid components to make authorized API calls and downloads
the associated service account key files. You can use
the service account key files generated by this command in your configuration overrides file.

The `create-service-account` tool is located in
`HYBRID_ROOT_DIR/tools` directory.

## Prerequisites

The `create-service-account` tool requires that the [`gcloud`](https://cloud.google.com/sdk/gcloud/) CLI be
installed. Users invoking the utility should have the role `Service Account Admin`.

To get started, be sure your `gcloud` project
configuration is set to the project you created in [Step 2: Create a Google Cloud project](https://docs.cloud.google.com/apigee/docs/hybrid/v1.4/precog-gcpproject.md.txt):

```
gcloud config list project
```


If you need to change the current project ID, use the following command:

```
gcloud config set project GC_PROJECT_ID
```

Where <var translate="no">GC_PROJECT_ID</var> is the project created in [Step 2: Create a Google Cloud project](https://docs.cloud.google.com/apigee/docs/hybrid/v1.4/precog-gcpproject.md.txt).

## create-service-account syntax

The `create-service-account` tool uses the following syntax:

```
create-service-account HYBRID_SERVICE OUTPUT_DIR [GC_PROJECT_ID]
```

Where:

- <var translate="no">HYBRID_SERVICE</var>: Specifies the hybrid service that uses the service account. Valid values are:
  - `apigee-cassandra`
  - `apigee-distributed-trace`
  - `apigee-logger`
  - `apigee-mart`
  - `apigee-metrics`
  - `apigee-synchronizer`
  - `apigee-udca`
  - `apigee-watcher`  

  Note that the `create-service-account` tool cannot create the
  `apigee-org-admin` service account. You must create that either with
  `gcloud` APIs, as described in [Create service accounts](https://docs.cloud.google.com/apigee/docs/hybrid/v1.4/install-download-install#create-service-accounts).
- <var translate="no">OUTPUT_DIR</var>: The output directory in which to store the downloaded service account key.
- <var translate="no">GCP_PROJECT_ID</var>: (Optional) Specifies the Google Cloud project ID of the project that is bound to your hybrid-enabled organization. If the Google Cloud project ID is not provided, the tool attempts to retrieve it from the current `gcloud` configuration.

## Detailed description

The `create-service-account` tool:

- Creates [Google Cloud service accounts](https://cloud.google.com/iam/docs/service-accounts) used by hybrid components. The created service account is granted the role required by the specific component to operate.
- Downloads the service account key to your system. You place the service account keys in your hybrid configuration overrides file, as explained in the hybrid [installation instructions](https://docs.cloud.google.com/apigee/docs/hybrid/v1.4/install-before-begin.md.txt).

The tool creates service accounts for the following components:

| Component^\*^ | Role | Required for basic install? | Description |
|---|---|---|---|
| `apigee-cassandra` | Storage Object Admin `roles/storage.objectAdmin` | Yes | Allows Cassandra backups to Cloud Storage, as described in [Backup and recovery](https://docs.cloud.google.com/apigee/docs/hybrid/v1.4/backup-recovery.md.txt). |
| `apigee-distributed-trace` | Cloud Trace Agent `roles/cloudtrace.agent` | Yes | Allows the hybrid runtime plane to participate in distributed request tracing in a format compatible with systems like [Google Cloud Trace](https://cloud.google.com/trace) and [Jaeger](https://www.jaegertracing.io/). |
| `apigee-logger` | Logs Writer `roles/logging.logWriter` | No | Allows logging data collection, as described in [Logging](https://docs.cloud.google.com/apigee/docs/hybrid/v1.4/logging.md.txt). Only required for non-GKE cluster installations. |
| `apigee-mart` | Apigee Connect Agent `roles/apigeeconnect.Agent` | Yes | Allows MART service authentication. The Apigee Connect Agent role allows it to communicate securely with the Apigee Connect process, as described in [Using Apigee Connect](https://docs.cloud.google.com/apigee/docs/hybrid/v1.4/apigee-connect.md.txt). |
| `apigee-metrics` | Monitoring Metric Writer `roles/monitoring.metricWriter` | No | Allows metrics data collection, as described in [Metrics collection overview](https://docs.cloud.google.com/apigee/docs/hybrid/v1.4/metrics-collection.md.txt). |
| `apigee-synchronizer` | Apigee Synchronizer Manager `roles/apigee.synchronizerManager` | Yes | Allows the synchronizer to download proxy bundles and environment configuration data. Also enables operation of the trace feature. |
| `apigee-udca` | Apigee Analytics Agent `roles/apigee.analyticsAgent` | Yes | Allows the transfer of trace, analytics and deployment status data to the management plane. |
| `apigee-watcher` | Apigee Runtime Agent `roles/apigee.runtimeAgent` | Yes | Apigee Watcher pulls virtual hosts related changes for an org from synchronizer and makes necessary changes to configure istio ingress. |
| ^\*^ This name is used in the downloaded service account key's filename. ||||

You can also create service accounts in the Google Cloud console. See also
[Creating
and managing service accounts](https://cloud.google.com/iam/docs/creating-managing-service-accounts).

## Example

The following example creates a new service account for the `apigee-logger`
service and places the downloaded key in the `./service-accounts` directory.

```
./my-hybrid-root/tools/create-service-account apigee-logger ./service-accounts
```