Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Tags sind Schlüssel/Wert-Paare, die Sie für eine differenzierte Zugriffssteuerung auf Ihre Dienste anwenden können. Tag-Administratoren erstellen Tags für Ressourcen in Google Cloud auf Organisations- oder Projektebene und verwalten sie im Resource Manager.
Mit Tags können Sie Richtlinien je nachdem, ob eine Ressource ein bestimmtes Tag hat, zulassen oder ablehnen.
Tags, die mit Cloud Run-Diensten angehängt werden, sollten nicht mit Traffic-Tags von Cloud Run verwechselt werden, die Traffic an bestimmte Cloud Run-Überarbeitungen weiterleiten können.
Erforderliche Rollen
Bitten Sie Ihren Administrator, Ihnen die folgenden IAM-Rollen für den Cloud Run-Dienst zuzuweisen, um die Berechtigungen zu erhalten, die Sie zum Anhängen oder Trennen von Tags benötigen:
Um den Zugriff auf die Tag-Wert-Ressource in Resource Manager zu verwalten, muss Ihrem Konto auch die Rolle Tag-Nutzer (roles/resourcemanager.tagUser) für den Tag-Wert zugewiesen werden.
Der Tag-Wert ist die Ressource, die mit dem Cloud Run-Dienst verknüpft ist.
Aktivieren Sie das Kästchen links neben dem Dienst, für den Sie das Tag festlegen möchten.
Klicken Sie über der Dienstliste auf Tags, um den Bereich "Tags" aufzurufen.
Wenn Ihre Organisation nicht im Bereich Tags angezeigt wird, klicken Sie auf Bereich auswählen. Wählen Sie Ihre Organisation aus und klicken Sie auf Öffnen.
Klicken Sie zum Anhängen eines neuen Tags an den Dienst auf Tag hinzufügen und wählen Sie einen der Tag-Schlüssel im Drop-down-Menü des Schlüssels aus. Wählen Sie dann einen Wert aus dem Drop-down-Menü "Wert" aus.
Klicken Sie auf Speichern und bestätigen Sie Ihre Änderungen, wenn Sie dazu aufgefordert werden.
gcloud
Sie können Tags für einen Dienst mit dem folgenden Befehl aktualisieren:
Wenn Sie mehrere Tags aktualisieren möchten, geben Sie eine durch Kommas getrennte Liste von Schlüssel/Wert-Paaren an.
Ersetzen
TAG_VALUE durch den Wert für den Schlüssel: Sie können diese verschiedenen Arten von IDs verwenden: eine permanente ID wie tagValues/12345678901, einen Namespace-Wert wie 123456789012/env/prod oder einen kurzen Namen wie prod
PROJECT_ID durch die Projekt-ID Ihres Google Cloud-Projekts
REGION durch die Region, in der Ihr Cloud Run-Dienst bereitgestellt wird
SERVICE durch den Namen Ihres Cloud Run-Dienstes
Tags trennen
Sie können die Console oder die Befehlszeile verwenden, um Tags von Ihrem Dienst zu trennen.
Wenn Sie mehrere Tags trennen möchten, geben Sie eine durch Kommas getrennte Liste von Schlüssel/Wert-Paaren an.
Ersetzen
TAG_VALUE durch den Wert für den Schlüssel: Sie können diese verschiedenen Arten von IDs verwenden: eine permanente ID wie tagValues/12345678901, einen Namespace-Wert wie 123456789012/env/prod oder einen kurzen Namen wie prod
PROJECT_ID durch die Projekt-ID Ihres Google Cloud-Projekts
REGION durch die Region, in der Ihr Cloud Run-Dienst bereitgestellt wird
[[["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: 2024-12-05 (UTC)."],[],[],null,["# Tag services\n\nTags are key-value pairs you can apply to your services for fine-grained access\ncontrol. Tag administrators create tags for resources across\nGoogle Cloud at the organization or project level and manage them in\n[Resource Manager](/resource-manager/docs/tags/tags-creating-and-managing).\nTags provides a way to conditionally allow or deny\npolicies based on whether a resource has a specific tag.\n\nTags *attached* to Cloud Run services should not be confused\nwith Cloud Run [traffic tags](/run/docs/rollouts-rollbacks-traffic-migration#tags)\nthat allow to route traffic to specific Cloud Run revisions.\n| **Note:** In contrast to tags, [labels](/run/docs/configuring/services/labels) are used to identify resources for billing-related reasons, filtering logs, and so forth.\n\nRequired roles\n--------------\n\n\nTo get the permissions that\nyou need to attach or detach tags,\n\nask your administrator to grant you the\nfollowing IAM roles on the Cloud Run service:\n\n- [Cloud Run Admin](/iam/docs/roles-permissions/run#run.admin) (`roles/run.admin`)\n- [Tag User](/iam/docs/roles-permissions/resourcemanager#resourcemanager.tagUser) (`roles/resourcemanager.tagUser`)\n\n\nTo manage access on the tag value resource in Resource Manager, your\naccount must also have the\n[Tag User](/iam/docs/understanding-roles#resourcemanager.tagUser) (`roles/resourcemanager.tagUser`) role\n[granted for the tag value](/resource-manager/docs/tags/tags-creating-and-managing#managing_access).\nThe tag value is the resource that is attached to the Cloud Run\nservice.\n\nFor a list of IAM roles and permissions that are associated with\nCloud Run, see\n[Cloud Run IAM roles](/run/docs/reference/iam/roles)\nand [Cloud Run IAM permissions](/run/docs/reference/iam/permissions).\nIf your Cloud Run service interfaces with\nGoogle Cloud APIs, such as Cloud Client Libraries, see the\n[service identity configuration guide](/run/docs/configuring/services/service-identity).\nFor more information about granting roles, see\n[deployment permissions](/run/docs/reference/iam/roles#additional-configuration)\nand [manage access](/iam/docs/granting-changing-revoking-access).\n\nAttaching tags\n--------------\n\nNote that attaching a tag to your service *does not* result in the creation\nof a new revision.\n\nYou can attach or detach tags using the Google Cloud console or the gcloud\ncommand line. \n\n### Console\n\n1. [Go to Cloud Run](https://console.cloud.google.com/run)\n\n2. Check the checkbox at the left of the service you are setting the tag\n on.\n\n3. Click **Tags** above the services list to display the tags pane.\n\n4. If your organization doesn't appear in the **Tags** panel, click\n **Select scope** . Select your organization and click\n **Open**.\n\n5. To attach a new tag to the service, click **Add Tag** and select one of the\n tag keys in the key dropdown menu, and select a value from the\n value dropdown menu.\n\n6. Click **Save** then confirm your changes if prompted.\n\n### gcloud\n\nYou can update tags for a service using the command: \n\n```bash\ngcloud resource-manager tags bindings create \\\n --tag-value=TAG_VALUE \\\n --parent=//run.googleapis.com/projects/PROJECT_ID/locations/REGION/services/SERVICE \\\n --location=REGION\n```\n\nTo update more than one tag, supply a comma delimited list of key/value\npairs.\n\nReplace\n\n- \u003cvar translate=\"no\"\u003eTAG_VALUE\u003c/var\u003e with the value for the key: you can use these different types of identifiers: a permanent ID such as `tagValues/12345678901`, a namespaced value such as `123456789012/env/prod` or a short name such as `prod`\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with project ID of your Google Cloud project\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e with region your Cloud Run service is deployed to\n- \u003cvar translate=\"no\"\u003eSERVICE\u003c/var\u003e with name of your Cloud Run service\n\nDetaching a tag\n---------------\n\nYou can use the console or the command line to detach tags from your service. \n\n### Console\n\n1. [Go to Cloud Run](https://console.cloud.google.com/run)\n\n2. Check the checkbox at the left of the service you are detaching the tag\n from.\n\n3. Click **Tags** above the services list to display the tags pane.\n\n4. Locate the tag you want to detach.\n\n5. Hover your cursor to the right of the *Value* dropdown menu for the tag to\n display the trash icon, and click the trash icon.\n\n6. Click **Save** and confirm your changes if prompted.\n\n### gcloud\n\nTo detach a tag from a service: \n\n```bash\ngcloud resource-manager tags bindings delete \\\n --tag-value=TAG_VALUE \\\n --parent=//run.googleapis.com/projects/PROJECT_ID/locations/REGION/services/SERVICE \\\n --location=REGION\n```\n\nTo detach more than one tag, supply a comma delimited list of key/value\npairs.\n\nReplace\n\n- \u003cvar translate=\"no\"\u003eTAG_VALUE\u003c/var\u003e with the value for the key: you can use these different types of identifiers: a permanent ID such as `tagValues/12345678901`, a namespaced value such as `123456789012/env/prod` or a short name such as `prod`\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with project ID of your Google Cloud project\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e with region your Cloud Run service is deployed to\n- \u003cvar translate=\"no\"\u003eSERVICE\u003c/var\u003e with name of your Cloud Run service"]]