Ein Dienstkonto ist eine spezielle Art von Konto in Google Cloud, mit dem Komponenten und Anwendungen eines Systems miteinander und mit anderen APIs interagieren können. Weitere Informationen zu Google Cloud finden Sie unter Informationen zu Google Cloud-Diensten.
Apigee Hybrid verwendet Google Cloud-Dienstkonten, um eine Vielzahl von Aufgaben auszuführen, darunter:
Log- und Messwertdaten senden
Trace-Anfragen abrufen
Verbindung zum API-Gateway für administrative API-Anfragen herstellen
Sicherungen ausführen
Proxy-Bundles herunterladen
Während ein Dienstkonto alle diese Vorgänge ausführen könnte, wird empfohlen, dass Sie mehrere Dienstkonten erstellen, die jeweils einer bestimmten Aufgabe zugewiesen sind und jedes Dienstkonto über eigene Berechtigungen verfügt. Dies verbessert die Sicherheit, da der Zugriff und die Berechtigungen für einzelne Dienstkonten entsprechend eingeschränkt werden. Wie bei Nutzerkonten werden diese Berechtigungen angewendet, indem dem Dienstkonto eine oder mehrere Rollen zugewiesen werden.
Dienstkonten und Rollen, die von Hybridkomponenten verwendet werden
Für einen ordnungsgemäßen Betrieb von Apigee müssen Sie mehrere Dienstkonten erstellen. Jedes Dienstkonto erfordert eine bestimmte Rolle oder Rollen, die es ihm ermöglichen, seine Funktion auszuführen.
In der folgenden Tabelle werden die Dienstkonten für die Hybridkomponenten beschrieben: Die Namen für jedes Dienstkonto sind die Standardnamen. Sie können beliebige Namen verwenden, aber die Namen sollten mit dem Zweck jedes Kontos leicht identifiziert werden können.
Ermöglicht die Erfassung von Logging-Daten, wie in Logging beschrieben. Nur für Nicht-GKE-Clusterinstallationen erforderlich.
apigee-mart
Apigee Connect Agent roles/apigeeconnect.Agent
Ermöglicht die Authentifizierung des MART-Dienstes. Die Rolle "Apigee Connect-Agent" erlaubt ihm die sichere Kommunikation mit dem Apigee Connect-Prozess, wie unter Apigee Connect verwenden beschrieben.
Ermöglicht die Übertragung von Trace-, Analyse- und Bereitstellungsstatusdaten auf die Verwaltungsebene.
apigee-watcher
Apigee-Laufzeit-Agent roles/apigee.runtimeAgent
Apigee Watcher ruft virtuelle Hosts für Änderungen an virtuellen Hosts aus dem Synchronizer ab und nimmt die erforderlichen Änderungen zur Konfiguration des Istio-Ingress vor.
* Dieser Name wird im Dateinamen des heruntergeladenen Dienstkontoschlüssels verwendet.
Alternativ können Sie für Nicht-Produktions-, Test- und Demoumgebungen ein einziges Dienstkonto verwenden, dem alle Rollen zugewiesen sind. Dies wird für Produktionsumgebungen nicht empfohlen.
Neben dem Erstellen der in dieser Tabelle aufgeführten Dienstkonten verwenden Sie die privaten Schlüssel jedes Kontos, um Zugriffstokens zu generieren, sodass Sie auf die Apigee APIs zugreifen können. Das create-service-account-Tool lädt die Schlüsseldateien beim Erstellen oder Aktualisieren der Dienstkonten automatisch in ein Verzeichnis auf Ihrem lokalen Computer herunter.
Dienstkonten erstellen
Es gibt mehrere Möglichkeiten, Dienstkonten zu erstellen, zum Beispiel:
Diese werden in den folgenden Abschnitten beschrieben.
create-service-account-Tool verwenden
Das create-service-account-Tool ist verfügbar, nachdem Sie apigeectl heruntergeladen und maximiert haben (im Verzeichnis tools/). Es arbeitet mit hybriden komponenten-spezifischen Dienstkonten und weist die erforderlichen Rollen für Sie zu. Das Tool lädt auch die Dienstkontoschlüssel automatisch herunter und speichert sie auf Ihrem lokalen Computer.
Mit dem folgenden Befehl werden beispielsweise alle separaten Dienstkonten für eine Produktionsumgebung erstellt, jedem Dienstkonto die entsprechenden IAM-Rollen zugewiesen und die private Schlüsseldatei jedes Kontos in das Verzeichnis ./service-accounts heruntergeladen:
./tools/create-service-account --env prod
Der folgende Befehl erstellt ein einzelnes Dienstkonto mit dem Namen apigee-non-prod mit allen IAM-Rollen für alle Hybridkomponenten, die für Demo- und Testumgebungen geeignet sind, aber nicht für Produktionsumgebungen:
Geben Sie im Feld Dienstkontoname einen Namen ein. Die Cloud Console füllt das Feld Dienstkonto-ID anhand dieses Namens aus.
Apigee empfiehlt, dass Sie einen Namen verwenden, der die Rolle des Dienstkontos widerspiegelt. Sie können für das Dienstkonto den gleichen Namen festlegen wie für die Komponente, die es verwendet.
Legen Sie beispielsweise den Namen des Dienstkontos „Log-Autor” auf apigee-logger fest.
Optional: Im Feld Beschreibung des Dienstkontos können Sie eine entsprechende Beschreibung eingeben. Beschreibungen helfen Ihnen, sich genau daran zu erinnern, wofür ein bestimmtes Dienstkonto verwendet wird.
Klicken Sie auf Erstellen und fortfahren.
Klicken Sie auf das Feld Rolle auswählen und wählen eine Rolle aus, wie unter Von Hybridkomponenten verwendete Dienstkonten und Rollen beschrieben. Wenn die Apigee-Rollen nicht in der Drop-down-Liste enthalten sind, aktualisieren Sie die Seite.
Wählen Sie beispielsweise für die Logging-Komponente die Rolle „Log-Autor” aus.
Geben Sie ggf. Text ein, um die Liste der Rollen nach Namen zu filtern. Wenn Sie beispielsweise nur die Apigee-Rollen auflisten möchten, geben Sie Apigee in das Filterfeld ein.
Sie können einem Dienstkonto mehrere Rollen hinzufügen, aber Apigee empfiehlt, für jedes empfohlene Dienstkonto nur eine Rolle zu verwenden. Die Rollen eines Dienstkontos können Sie nach dem Erstellen in der Cloud Console auf der Seite IAM ändern.
Klicken Sie auf Weiter.
In Google Cloud wird die Ansicht Nutzern Zugriff auf dieses Dienstkonto erteilen angezeigt:
Klicken Sie unter Schlüssel erstellen (optional) auf Schlüssel erstellen.
In Google Cloud haben Sie die Möglichkeit, einen JSON- oder P12-Schlüssel herunterzuladen:
Wählen Sie JSON (Standardeinstellung) aus und klicken Sie auf Erstellen.
Google Cloud speichert die Schlüsseldatei im JSON-Format auf Ihrem lokalen Computer und zeigt eine Bestätigung an, wenn der Vorgang erfolgreich war, wie im folgenden Beispiel gezeigt:
Später werden Sie einige der Dienstkontoschlüssel zum Konfigurieren von hybriden Laufzeitdiensten verwenden.
Wenn Sie zum Beispiel die Hybridlaufzeit konfigurieren, geben Sie den Speicherort der Dienstkontoschlüssel mithilfe der Attribute SERVICE_NAME.serviceAccountPath ein.
Diese Schlüssel werden von den Dienstkonten zum Abrufen von Zugriffstokens verwendet, mit denen sie dann in Ihrem Namen Anfragen an die Apigee APIs senden. (Bis dahin dauert es aber noch. Merken Sie sich im Moment nur den Speicherort.)
Wenn Sie fertig sind, sollten Sie zusätzlich zu den Standardeinstellungen (falls vorhanden) folgende Dienstkonten haben:
In der Google Cloud Console werden Dienstkonten durch das Symbol gekennzeichnet.
Wenn Sie ein Dienstkonto erstellt haben und eine Rolle hinzufügen oder entfernen möchten, müssen Sie die Ansicht IAM & Verwaltung verwenden. Rollen für Dienstkonten können nicht in der Ansicht Dienstkonten verwaltet werden.
APIs zum Erstellen von gcloud-Dienstkonten verwenden
Sie können Dienstkonten mit der Cloud Identity and Access Management API erstellen und verwalten.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-08-28 (UTC)."],[[["\u003cp\u003eApigee hybrid utilizes Google Cloud service accounts to carry out various operations, such as sending log and metrics data, pulling trace requests, connecting to the API gateway, executing backups, and downloading proxy bundles.\u003c/p\u003e\n"],["\u003cp\u003eFor enhanced security in production environments, it is recommended to create multiple service accounts, each dedicated to a specific task with its own set of permissions, rather than using a single account for all operations.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ecreate-service-account\u003c/code\u003e tool is recommended for creating hybrid component-specific service accounts, as it automatically assigns the necessary roles and downloads the service account keys.\u003c/p\u003e\n"],["\u003cp\u003eIn non-production, testing, and demo environments, a single service account with all required roles can be used, whereas in production you must utilize several service accounts, each with its own key, and specific role.\u003c/p\u003e\n"],["\u003cp\u003eReusing the name of a deleted service account can cause unexpected issues; if a service account is deleted, always recreate it with a unique name.\u003c/p\u003e\n"]]],[],null,["# About service accounts\n\n| You are currently viewing version 1.7 of the Apigee hybrid documentation. **This version is end of life.** You should upgrade to a newer version. For more information, see [Supported versions](/apigee/docs/hybrid/supported-platforms#supported-versions).\n\nA *service account* is a special type of account in Google Cloud that enables components\nand applications of a system to interact with each other and with other APIs. For more information\nabout Google Cloud, see [About Google Cloud services](/apigee/docs/hybrid/v1.7/what-is-hybrid#about-gcp).\n| **SERVICE ACCOUNT FACTOID** \n| Google Cloud projects have a limit of 100 service accounts---including the default service accounts (if any).\n\nApigee hybrid uses Google Cloud service accounts to perform a variety of tasks, including:\n\n- Send log and metrics data\n- Pull trace requests\n- Connect to API gateway for administrative API requests\n- Execute back ups\n- Download proxy bundles\n\nWhile one service account *could* perform all of these operations, for production\nenvironments Apigee recommends that you create multiple service accounts, each assigned to a\nspecific task and each with its own set of permissions. This enhances security by\ncompartmentalizing access and limiting each service account's scope and access privileges. As with\nuser accounts, these permissions are applied by assigning one or more roles to the service\naccount.\n\nService accounts and roles used by hybrid components\n----------------------------------------------------\n\nTo operate properly, Apigee hybrid requires you to create several service accounts. Each\nservice account requires a specific role or roles that enable it to perform its function.\n\nThe following table describes the service accounts for the hybrid components. The names given for\neach service account are the default names. You can use any names you want, but the names should be\neasy to identify with each account's purpose.\n\n\nAs an alternative, for nonproduction, test, and demo environments, you can use a single service\naccount with all the roles assigned to it. This is not recommended for production environments.\n\nIn addition to creating the service accounts listed in this table, you will use each accounts\nprivate keys to generate access tokens so that you can access the Apigee APIs. The\n`create-service-account` tool automaticallyl downloads the key files into a directory\non your local machine when it creates or updates the service accounts.\n\nCreate the service accounts\n---------------------------\n\n| **Deleting and recreating service accounts:** Note that reusing the name of a deleted service account may result in unexpected behavior. If you create a service account and delete it, always recreate it with a unique name. For details, see [Deleting and recreating service accounts](/iam/docs/service-account-overview#deleting-recreating).\n\nThere are several ways to create service accounts, including:\n\n- (*Recommended* ) [`create-service-account` tool](#tool)\n- [Google Cloud console](#gcp)\n- [gcloud SDK](#gcloud)\n\nEach of these is described in the following sections.\n\n### Use the `create-service-account` tool\n\nThe `create-service-account` tool is available after you\n[download and expand `apigeectl`](/apigee/docs/hybrid/v1.7/install-apigeectl) in the\n`tools/` directory. It hybrid component-specific service accounts and assigns\nthe required roles for you. The tool also automatically downloads the service account keys and\nstores them on your local machine.\n\nFor example, the following command will create all the separate individual service accounts for a\nproduction environment, assign the appropriate IAM roles to each service account, and download\neach accounts private key file to the `./service-accounts` directory: \n\n```\n./tools/create-service-account --env prod\n```\n\n\nThe following command creates a single service account named `apigee-non-prod` with all IAM\nroles for all hybrid components,\nsuitable for demo and test environments, but not for production environments: \n\n```\n./tools/create-service-account --env non-prod\n```\n\nFor more information on using `create-service-account`, see\n[create-service-account reference](/apigee/docs/hybrid/v1.7/create-service-account).\n\n### Use the Google Cloud console\n\nYou can create service accounts with the Google Cloud console.\n| **Note:** To create service accounts in the Google Cloud console, you must have the Google Cloud Service Account Admin role or greater.\n\n**To create a service account with the Google Cloud console and generate a key for the\nservice account, do the following:**\n\n1. Create a service account:\n\n 1. In the Cloud console, go to the **Service Accounts** page.\n\n [Go to\n Service Accounts](https://console.cloud.google.com/iam-admin/serviceaccounts)\n 2. Select your project.\n 3. Click add**Create Service Account**.\n 4.\n In the **Service account name** field, enter a name. The\n Cloud console fills in the **Service account ID** field based on\n this name.\n\n\n Apigee recommends that you use a name that reflects the service account's role; you\n can set the name of the service account to be the same name as the component that uses it.\n For example, set the name of the Logs Writer service account `apigee-logger`.\n\n\n For more information about the service accounts names and roles, see\n [Service accounts and roles used by hybrid components](#recommended-sas).\n 5. Optional: In the **Service account description** field, enter a description for the service account. Descriptions are helpful at reminding you what a particular service account is used for.\n 6. Click **Create and continue**.\n 7.\n Click the **Select a role** field and select a role, as described in\n [Service accounts and roles used by hybrid components](#recommended-sas). If\n the Apigee roles do not appear in the drop down list, refresh the page.\n\n For example, for the logging component, select the Logs Writer role.\n\n\n If necessary, enter text to filter the list of roles by name. For example, to list only\n the Apigee roles, enter `Apigee` in the filter field.\n\n\n You can add more than one role to a service account, but Apigee recommends that\n you only use one role for each of the recommended service accounts. To change the roles of\n a service account after you have created it, use the **IAM**\n page in the Cloud console.\n | **Note:** If you do not see the roles listed in [Recommended service accounts](#recommended-sas), check with your Apigee account representative to be sure that your account was properly configured and that your organization was provisioned.\n 8. Click **Continue** .\n\n Google Cloud displays the **Grant users access to this service account** view:\n\n 9. Under **Create key (optional)** , click **Create Key** .\n\n Google Cloud gives you the option to download a JSON or P12 key:\n\n 10. Select JSON (the default) and click **Create** .\n\n Google Cloud saves the key file in JSON format to your local machine and displays a confirmation when\n it is successful, as the following example shows:\n\n You will later use some of the service account keys to configure hybrid runtime services.\n For example, when you configure the hybrid runtime, you will specify the location of the service\n account keys using the \u003cvar translate=\"no\"\u003eSERVICE_NAME\u003c/var\u003e`.serviceAccountPath` properties.\n\n These keys are used by the service accounts to get access tokens, which the service account\n then uses to make requests against the Apigee APIs on your behalf. (But that's not for a while\n yet; for now, just remember where you saved it.)\n 11. Repeat steps 4 through 11 for each service account listed in [Service accounts and roles used by hybrid components](#recommended-sas) (except the `apigee-mart` account---which has no role associated with it---so do not assign it a role).\n\n When you're finished, you should have the following service accounts (in addition to the\n defaults, if any):\n\n\n In the Google Cloud console, service accounts are indicated with the\n icon.\n\n After you create a service account, if you want to add or remove a role to it, you must use\n the **IAM \\& Admin** view. You cannot manage roles for service accounts in the\n **Service accounts** view.\n | **Tip:** Apigee hybrid includes a validator that checks your service accounts' key files and permissions when [apigeectl](/apigee/docs/hybrid/v1.7/cli-reference) applies the Apigee hybrid runtime components to your cluster. This validation is enabled by default. For more information, see [Service account\n | validation](/apigee/docs/hybrid/v1.7/sa-validation).\n\n ### Use the gcloud service account creation APIs\n\n You can create and manage service accounts with the Cloud Identity and Access Management API.\n\n For more information, see\n [Creating\n and managing service accounts](/iam/docs/creating-managing-service-accounts).\n\n Troubleshooting\n ---------------\n\n | **Deleting and recreating service accounts:** Note that reusing the name of a deleted service account, may result in unexpected behavior. If you create a service account and delete it, always recreate it with a unique name. For details, see [Deleting and recreating service accounts](/iam/docs/service-account-overview#deleting-recreating)."]]