ADC für lokale Umgebungen oder andere Cloud-Anbieter einrichten
Wenn Sie Ihre Anwendung außerhalb von Trusted Cloudausführen, müssen Sie Anmeldedaten angeben, die von Trusted Cloud erkannt werden, um Trusted Cloud -Dienste zu verwenden.
Workload Identity-Föderation
Die bevorzugte Methode zur Authentifizierung bei Trusted Cloud mit Anmeldedaten eines externen Identitätsanbieters ist die Verwendung einer Workload Identity-Föderation. Sie erstellen eine Konfigurationsdatei für Anmeldedaten und legen die Umgebungsvariable GOOGLE_APPLICATION_CREDENTIALS fest, die auf ihn verweist. Dieser Ansatz ist sicherer als das Erstellen eines Dienstkontoschlüssels.
Wenn Sie keine Workload Identity-Föderation konfigurieren können, müssen Sie ein Dienstkonto erstellen, ihm die von Ihrer Anwendung benötigten IAM-Rollen zuweisen und einen Schlüssel für das Dienstkonto erstellen.
So erstellen Sie einen Dienstkontoschlüssel und stellen ihn für ADC bereit:
Erstellen Sie ein Dienstkonto mit den Rollen, die Ihre Anwendung benötigt, sowie einen Schlüssel für dieses Dienstkonto. Folgen Sie dazu der Anleitung unter Dienstkontoschlüssel erstellen.
Set the environment variable GOOGLE_APPLICATION_CREDENTIALS
to the path of the JSON file that contains your credentials.
This variable applies only to your current shell session, so if you open
a new session, set the variable again.
Example: Linux or macOS
exportGOOGLE_APPLICATION_CREDENTIALS="KEY_PATH"
Replace KEY_PATH with the path of the JSON file that contains your credentials.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Benötigte Informationen nicht gefunden","missingTheInformationINeed","thumb-down"],["Zu umständlich/zu viele Schritte","tooComplicatedTooManySteps","thumb-down"],["Nicht mehr aktuell","outOfDate","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Problem mit Beispielen/Code","samplesCodeIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-08-18 (UTC)."],[[["\u003cp\u003eIf running applications outside of Google Cloud, you need to provide credentials recognized by Google Cloud to access its services.\u003c/p\u003e\n"],["\u003cp\u003eWorkload Identity Federation is the recommended method for authenticating with Google Cloud using external credentials, as it is more secure than service account keys.\u003c/p\u003e\n"],["\u003cp\u003eIf Workload Identity Federation is not feasible, service account keys can be used, but they pose a security risk and should be avoided if possible.\u003c/p\u003e\n"],["\u003cp\u003eTo use service account keys, create a service account with the necessary roles, generate a key, and set the \u003ccode\u003eGOOGLE_APPLICATION_CREDENTIALS\u003c/code\u003e environment variable to the key file's path.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eGOOGLE_APPLICATION_CREDENTIALS\u003c/code\u003e environment variable directs Application Default Credentials (ADC) to the specified credential location, and it takes precedence over other credential locations.\u003c/p\u003e\n"]]],[],null,[]]