Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Sie können die Richtlinie für die Identitäts- und Zugriffsverwaltung (Identity and Access Management, IAM) oder die Zugriffssteuerung für einen oder mehrere Konnektivitätstests festlegen oder abrufen. Darüber hinaus können Sie die Berechtigungen aufrufen, die ein Nutzer oder ein Dienstkonto für einen bestimmten Konnektivitätstest hat.
Dieses Dokument zeigt Beispiele für die Zugriffssteuerung, bei denen die Network Management API verwendet wird.
Informationen zum Ausführen dieser Schritte in der Google Cloud Console oder mithilfe von gcloud-Befehlen finden Sie in den IAM-Anleitungen.
Informationen zu Richtlinienbindungen und ETags, die in den folgenden Befehlen aufgeführt sind, finden Sie in der API-Referenz für IAM-Richtlinien.
Informationen zu den IAM-Rollen und Berechtigungen, die zum Ausführen von Konnektivitätstests erforderlich sind, finden Sie unter Rollen und Berechtigungen.
Richtlinien für die Zugriffssteuerung festlegen
Mit diesem Verfahren wird die Zugriffssteuerungsrichtlinie für die angegebene Konnektivitätstests-Ressource festgelegt.
TEST_ID: die ID des Objekts "Konnektivitätstests" (Test), das Sie ausführen
VERSION: gibt das Format der Richtlinie an. Gültige Werte sind 0, 1 und 3. Bei jedem Vorgang, der sich auf bedingte Rollenbindungen auswirkt, muss die Version 3 angegeben werden.
ETAG: wird für eine optimistische Gleichzeitigkeitserkennung verwendet, mit der verhindert werden kann, dass sich gleichzeitige Aktualisierungen einer Richtlinie gegenseitig überschreiben (ein ETag ist z. B. BwWbrqiZFRs=).
ROLE: eine Rolle, die Hauptkonten zugewiesen ist (z. B. roles/networkmanagement.admin)
PRINCIPAL: gibt die Identitäten an, die Zugriff auf eine Google Cloud Ressource anfordern, z. B. user:username@yourcompany.com. Eine Liste der Hauptkonten oder Mitgliedertypen finden Sie in der API-Referenz zu IAM-Richtlinien.
Zugriffssteuerungsrichtlinie abrufen
In diesem Verfahren wird die Zugriffssteuerungsrichtlinie für die angegebene Konnektivitätstests-Ressource abgerufen.
TEST_ID: die ID des Objekts "Konnektivitätstests" (Test), das Sie ausführen
VERSION: gibt das Format der Richtlinie an. Gültige Werte sind 0, 1 und 3. Bei jedem Vorgang, der sich auf bedingte Rollenbindungen auswirkt, muss die Version 3 angegeben werden.
ETAG: wird für eine optimistische Gleichzeitigkeitserkennung verwendet, mit der verhindert werden kann, dass sich gleichzeitige Aktualisierungen einer Richtlinie gegenseitig überschreiben (ein ETag ist z. B. BwWbrqiZFRs=).
ROLE: eine Rolle, die Hauptkonten zugewiesen wird (z. B. roles/networkmanagement.admin)
PRINCIPAL: gibt die Identitäten an, die Zugriff auf eine Google Cloud Ressource anfordern, z. B. user:username@yourcompany.com. Eine Liste der Hauptkonten finden Sie in der API-Referenz zu IAM-Richtlinien.
Test IAM-Berechtigungen
Bei diesem Verfahren werden Berechtigungen zurückgegeben, die ein Nutzer oder Dienstkonto für eine Konnektivitätstests-Ressource hat.
[[["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-09-03 (UTC)."],[],[],null,["# Manage access policies\n\nYou can set or get the Identity and Access Management (IAM), or access control, policy for\none or more Connectivity Tests. In addition, you can view the\npermissions that a user or service account has for a specific\nConnectivity Test.\n\nThis document shows access control examples that use the Network Management API.\nTo follow these steps in the Google Cloud console or by using `gcloud` commands,\nsee the [IAM how-to guides](/iam/docs/how-to).\n\nFor information about policy bindings and etags listed in the following commands,\nsee the [API reference for IAM policies](/iam/docs/reference/rest/v1/Policy).\n\nFor information about the IAM roles and permissions needed to run\nConnectivity Tests, see\n[Roles and permissions](/network-intelligence-center/docs/connectivity-tests/concepts/access-control).\n\nSet an access control policy\n----------------------------\n\nThis procedure sets the access control policy on the specified\nConnectivity Tests resource. \n\n### API\n\nUse the [`networkmanagement.connectivitytests.setIamPolicy`](/network-intelligence-center/docs/connectivity-tests/reference/networkmanagement/rest/v1/projects.locations.global.connectivityTests/setIamPolicy)\nmethod to set the access control policy for a \u003cvar translate=\"no\"\u003eUSER\u003c/var\u003e,\n\u003cvar translate=\"no\"\u003eROLE\u003c/var\u003e, and \u003cvar translate=\"no\"\u003eTEST_ID\u003c/var\u003e.\n\nThe following example sets a policy that binds the role of\n`networkmanagement.admin` to `username@yourcompany.com` for `mytest-1`. \n\n```\n POST https: //networkmanagement.googleapis.com/v1/{resource=projects/*/locations/global/connectivityTests/TEST_ID}:setIamPolicy\n {\n \"version\": \"VERSION\",\n \"etag\": \"ETAG\",\n \"bindings\": [{\n \"role\": \"ROLE\",\n \"members\": [\n \"PRINCIPAL\"\n ]\n }]\n }\n```\n\nReplace the following values:\n\n- \u003cvar translate=\"no\"\u003eTEST_ID\u003c/var\u003e: the ID of the Connectivity Tests object (test) that you are running\n- \u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e: specifies the format of the policy; valid values are `0`, `1`, and `3`---any operation that affects conditional role bindings must specify version `3`\n- \u003cvar translate=\"no\"\u003eETAG\u003c/var\u003e: used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other (an example etag is `BwWbrqiZFRs=`)\n- \u003cvar translate=\"no\"\u003eROLE\u003c/var\u003e: a role that is assigned to principals (for example, `roles/networkmanagement.admin`)\n- \u003cvar translate=\"no\"\u003ePRINCIPAL\u003c/var\u003e: specifies the identities requesting access for a Google Cloud resource (for example, `user:username@yourcompany.com`); for a list of principal, or member, types, see the [API reference for IAM policies](/iam/docs/reference/rest/v1/Policy)\n\nGet an access control policy\n----------------------------\n\nThis procedure gets the access control policy for the specified\nConnectivity Tests resource. \n\n### API\n\nUse the [`networkmanagement.connectivitytests.getIamPolicy`](/network-intelligence-center/docs/connectivity-tests/reference/networkmanagement/rest/v1/projects.locations.global.connectivityTests/getIamPolicy)\nmethod to set the access control policy for a \u003cvar translate=\"no\"\u003ePRINCIPAL\u003c/var\u003e,\n\u003cvar translate=\"no\"\u003eROLE\u003c/var\u003e, and \u003cvar translate=\"no\"\u003eTEST_ID\u003c/var\u003e.\n\nThe following example gets a policy that binds the role of\n`networkmanagement.admin` to `username@yourcompany.com` for `mytest-1`. \n\n```\n GET https: //networkmanagement.googleapis.com/v1/{resource=projects/*/locations/global/connectivityTests/TEST_ID}:getIamPolicy\n {\n \"version\": \"VERSION\",\n \"etag\": \"ETAG\",\n \"bindings\": [{\n \"role\": \"ROLE\",\n \"members\": [\n \"PRINCIPAL\"\n ]\n }]\n }\n```\n\nReplace the following values:\n\n- \u003cvar translate=\"no\"\u003eTEST_ID\u003c/var\u003e: the ID of the Connectivity Tests object (test) that you are running\n- \u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e: specifies the format of the policy; valid values are `0`, `1`, and `3`---any operation that affects conditional role bindings must specify version `3`\n- \u003cvar translate=\"no\"\u003eETAG\u003c/var\u003e: used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other (an example etag is `BwWbrqiZFRs=`)\n- \u003cvar translate=\"no\"\u003eROLE\u003c/var\u003e: a role that is assigned to principals (for example, `roles/networkmanagement.admin`)\n- \u003cvar translate=\"no\"\u003ePRINCIPAL\u003c/var\u003e: specifies the identities requesting access for a Google Cloud resource (for example, `user:username@yourcompany.com`); for a list of principal types, see the [API reference for IAM policies](/iam/docs/reference/rest/v1/Policy)\n\nTest IAM permissions\n--------------------\n\nThis procedure returns permissions that a user or service account has for a\nConnectivity Tests resource. \n\n### API\n\nUse the [`networkmanagement.connectivitytests.testIamPermissions`](/network-intelligence-center/docs/connectivity-tests/reference/networkmanagement/rest/v1/projects.locations.global.connectivityTests/testIamPermissions)\nmethod to return the permissions assigned to a \u003cvar translate=\"no\"\u003eTEST_ID\u003c/var\u003e.\n\nThe following example verifies that `username@yourcompany.com` has the\n`networkmanagement.connectivitytests.get` permission for `mytest-1`. \n\n```\n POST https://networkmanagement.googleapis.com/v1/{resource=projects/*/locations/global/connectivityTests/TEST_ID}:testIamPermissions\n {\n \"permissions\": [\n \"networkmanagement.connectivitytests.get\"\n ]\n }\n```\n\nReplace \u003cvar translate=\"no\"\u003eTEST_ID\u003c/var\u003e with the ID of the\nConnectivity Tests object (test) that you are running.\n\nWhat's next\n-----------\n\n- [Learn about Connectivity Tests](/network-intelligence-center/docs/connectivity-tests/concepts/overview)\n- [Troubleshoot Connectivity Tests](/network-intelligence-center/docs/connectivity-tests/support/troubleshooting)"]]