Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Gruppen mit Identitätszuweisung erstellen und suchen
Auf dieser Seite wird erläutert, wie Sie Gruppen mit Identitätszuweisung erstellen und suchen. Eine Gruppe mit Identitätszuweisung ist eine Art Gruppe, die eine Gruppe in einer externen Identitätsquelle spiegelt, z. B. eine Active Directory-Gruppe. Gruppen mit Identitätszuweisung werden beim Erstellen eines Identitätsconnectors für Google Cloud Search verwendet.
Weitere Informationen zu Gruppen mit Identitätszuweisung finden Sie unter Groups API – Übersicht.
In folgenden Abschnitten wird die Verwaltung von Gruppen mit Identitätszuweisung demonstriert.
Hinweis
Führen Sie folgende Aufgaben aus, bevor Sie die Informationen auf dieser Seite umsetzen:
Rufen Sie zum Erstellen einer Gruppe mit Identitätszuweisung groups.create() mit einer Instanz der neuen Gruppe auf. Die Gruppeninstanz muss einen groupKey, einen Parent und ein label enthalten, das auf system/groups/external festgelegt ist. groupKey ist eine Kombination aus namespace und groupId, die die Gruppe eindeutig identifiziert.
Python
Im folgenden Beispiel wird eine Hilfsfunktion zum Erstellen einer Gruppe mit Identitätszuweisung mit der Python-Clientbibliothek gezeigt: Verwenden Sie die Identitätsquellen-ID, die Sie beim Erstellen der Identitätsquelle in der Admin-Konsole erhalten haben, um die Hilfsfunktion aufzurufen und eine Gruppe zu erstellen:
defcreate_identity_group(service,identity_source_id,group_id,group_display_name,group_description):namespace="identitysources/"+identity_source_idgroup_key={"id":group_id,"namespace":namespace}group={"parent":namespace,"description":group_description,"displayName":group_display_name,"groupKey":group_key,"labels":{# Set the label to specify creation of an identity group."system/groups/external":""}}try:response=service.groups().create(body=group).execute()printresponseexceptException,e:printemyNewGroup=create_identity_group(idSvc,"ABC1234","zebra","Zebra external group","The Zebra group is an identity group representing the Zoolandexternalidentity")
Durch Angabe des Namespace wird gewährleistet, dass keine Namenskonflikte auftreten und die Gruppe mit Identitätszuweisung in den richtigen Zusammenhang mit anderen Gruppen aus derselben externen Identitätsquelle gebracht wird.
Nach Gruppen mit Identitätszuweisung suchen
REST
Rufen Sie zum Suchen nach Gruppen mit Identitätszuweisung groups.search() mit einem Abfragestring auf. Wenn Sie nach allen Gruppen suchen möchten, müssen Sie nur das Label system/groups/external angeben.
Python
Im folgenden Beispiel wird eine Hilfsfunktion zum Suchen nach einer Gruppe mit Identitätszuweisung mit der Python-Clientbibliothek gezeigt:
defsearch_identity_groups(service,identity_source_id,pageSize,view):# Set the label to search for all identity groupssearchQuery="&query=namespace=identitysources/"+identity_source_id \
+"%20AND%20"+"labels:system/groups/external" \
+"&pageSize="+pageSize+"&view="+viewtry:searchGroupsRequest=service.groups().search()searchGroupsRequest.uri+=searchQueryresponse=searchGroupsRequest.execute()printresponseexceptException,e:printe
Nächste Schritte
Sobald eine Gruppe vorhanden ist, können Sie Mitgliedschaften für die Gruppe erstellen. Informationen zum Erstellen von Mitgliedschaften für Gruppen mit Identitätszuweisung finden Sie unter Mitgliedschaft in Gruppen mit Identitätszuweisung 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-18 (UTC)."],[[["\u003cp\u003eIdentity-mapped groups mirror groups in external identity sources like Active Directory and are used when creating an identity connector for Google Cloud Search.\u003c/p\u003e\n"],["\u003cp\u003eCreating an identity-mapped group involves using the \u003ccode\u003egroups.create()\u003c/code\u003e API method and providing a \u003ccode\u003egroupKey\u003c/code\u003e, \u003ccode\u003eParent\u003c/code\u003e, and \u003ccode\u003elabel\u003c/code\u003e set to \u003ccode\u003esystem/groups/external\u003c/code\u003e, with the \u003ccode\u003egroupKey\u003c/code\u003e uniquely identifying the group through a \u003ccode\u003enamespace\u003c/code\u003e and \u003ccode\u003egroupId\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eWhen creating the identity group using Python, the namespace must be included to avoid naming conflicts and to ensure the group is in the proper context of the external identity source.\u003c/p\u003e\n"],["\u003cp\u003eSearching for identity-mapped groups is done via the \u003ccode\u003egroups.search()\u003c/code\u003e API method, where providing the \u003ccode\u003esystem/groups/external\u003c/code\u003e label will return all such groups.\u003c/p\u003e\n"],["\u003cp\u003eAfter creating an identity group, the next step is to create memberships, using the procedures described in "Managing identity-mapped group memberships".\u003c/p\u003e\n"]]],[],null,["# Creating and searching for identity-mapped groups\n=================================================\n\nThis page explains how to create and search for *identity-mapped groups*. An\nidentity-mapped group is a type of group that mirrors a group in an\nexternal identity source, such as an Active Directory group. Identity-mapped\ngroups are used when creating an identity connector for Google Cloud Search.\n\nFor more information about identity-mapped groups, see\n[Groups API overview](/identity/docs/groups#group-types).\n\nThe following sections demonstrate how to manage identity-mapped groups.\n\nBefore you begin\n----------------\n\n| **Note:** Before you use any of the Cloud Identity APIs, you must set up Cloud Identity. See [Setting up Cloud Identity](/identity/docs/set-up-cloud-identity-admin) for instructions.\n\nPerform the following tasks before proceeding with the information on this page:\n\n- [Create the identity source](https://support.google.com/a/answer/9039510)\n in the Google Admin console.\n\n- Read the [Groups API overview](/identity/docs/groups).\n\n- [Set up the Groups API](/identity/docs/how-to/setup).\n\nCreating an identity-mapped group\n---------------------------------\n\n### REST\n\nTo create an identity-mapped group, call\n[`groups.create()`](/identity/docs/reference/rest/v1/groups/create) with an\ninstance of the new group. The group instance must include a `groupKey` ,\n`Parent`, and `label` set to `system/groups/external`. The `groupKey` is a\ncombination of `namespace` and `groupId` that uniquely identifies the group.\n\n### Python\n\nThe following example shows a helper function to create an identity group\nusing the Python client library. Use the identity source ID, obtained when you\ncreated the identity source in the Google Admin console, to call the helper\nfunction and create a group: \n\n def create_identity_group(service, identity_source_id, group_id, group_display_name,\n group_description):\n namespace = \"identitysources/\" + identity_source_id\n group_key = {\"id\": group_id, \"namespace\": namespace}\n group = {\n \"parent\": namespace,\n \"description\": group_description,\n \"displayName\": group_display_name,\n \"groupKey\": group_key,\n \"labels\": {\n # Set the label to specify creation of an identity group.\n \"system/groups/external\": \"\"\n }\n }\n\n try:\n response = service.groups().create(body=group).execute()\n print response\n except Exception, e:\n print e\n\n myNewGroup = create_identity_group(\n idSvc,\n \"ABC1234\",\n \"zebra\",\n \"Zebra external group\",\n \"The Zebra group is an identity group representing the Zooland\n external identity\"\n )\n\nProviding the namespace ensures that you won't experience any naming\ncollisions, and places the identity-mapped group in the proper context of other\ngroups from the same external identity source.\n\n### Searching for identity-mapped groups\n\n### REST\n\nTo search for identity-mapped groups, call\n[`groups.search()`](/identity/docs/reference/rest/v1/groups/search) with a\nquery string. To search for all groups, you only need to provide the label\n`system/groups/external`.\n\n### Python\n\nThe following example shows a helper function used to\nsearch for identity-mapped groups using the Python client library: \n\n def search_identity_groups(service, identity_source_id, pageSize, view):\n # Set the label to search for all identity groups\n searchQuery = \"&query=namespace=identitysources/\" + identity_source_id \\\n + \"%20AND%20\" + \"labels:system/groups/external\" \\\n + \"&pageSize=\" + pageSize + \"&view=\" + view\n try:\n searchGroupsRequest = service.groups().search()\n searchGroupsRequest.uri += searchQuery\n response = searchGroupsRequest.execute()\n print response\n except Exception, e:\n print e\n\nWhat's next\n-----------\n\nAfter a group exists, you can create memberships for it. To create memberships\nfor an identity-mapped group, refer to\n[Managing identity-mapped group memberships](/identity/docs/how-to/memberships-identity-groups)."]]