[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-07。"],[],[],null,["# Manage access to a Vertex AI Workbench managed notebooks instance\n\nManage access to a managed notebooks instance\n=============================================\n\n\n| Vertex AI Workbench managed notebooks is\n| [deprecated](/vertex-ai/docs/deprecations). On\n| April 14, 2025, support for\n| managed notebooks will end and the ability to create managed notebooks instances\n| will be removed. Existing instances will continue to function\n| but patches, updates, and upgrades won't be available. To continue using\n| Vertex AI Workbench, we recommend that you\n| [migrate\n| your managed notebooks instances to Vertex AI Workbench instances](/vertex-ai/docs/workbench/managed/migrate-to-instances).\n\n\u003cbr /\u003e\n\nThis guide describes how you can grant access to\na specific Vertex AI Workbench managed notebooks instance.\nTo manage access to Vertex AI resources, see\nthe [Vertex AI page on access control](/vertex-ai/docs/general/access-control).\n\nYou grant access to a managed notebooks instance by setting an\n[Identity and Access Management (IAM) policy](/iam/docs/policies) on the instance.\nThe policy binds one or more principals, such as a user or a\nservice account, to one or more\n[roles](/vertex-ai/docs/workbench/managed/access-control#predefined-roles).\nEach role contains a list of permissions that let the principal interact\nwith the instance.\n\nYou can grant access to an instance, instead of to a parent resource\nsuch as a project, folder, or organization, to exercise the\nprinciple of [least privilege](/iam/docs/using-iam-securely#least_privilege).\n\nIf you grant access to a\n[parent resource](/iam/docs/resource-hierarchy-access-control)\n(for example, to a project), you implicitly grant access to all its child\nresources (for example, to all instances in that project). To limit access to\nresources, set IAM policies on lower-level resources when\npossible, instead of at the project level or above.\n\nFor general information about how to grant, change, and revoke access to\nresources unrelated to Vertex AI Workbench, for example, to grant access to\na Google Cloud project, see the IAM documentation for\n[Granting, changing, and revoking access\nto resources](/iam/docs/granting-changing-revoking-access).\n\n### Access limitations\n\nAccess to an instance can include a broad range of abilities, depending\non the role you assign to the principal. For example,\nyou might grant a principal the ability to start, stop, upgrade, and\nmonitor the health status of an instance. For the complete list of\nIAM permissions available, see [Predefined\nmanaged notebooks IAM\nroles](/vertex-ai/docs/workbench/managed/access-control#predefined-roles).\n\nHowever, even granting a principal full access to\na managed notebooks instance doesn't grant\nthe ability to use the instance's JupyterLab interface.\nTo grant access to the JupyterLab interface, see [Manage access to a\nmanaged notebooks instance's\nJupyterLab interface](/vertex-ai/docs/workbench/managed/manage-access-jupyterlab).\n\nGrant access to managed notebooks instances\n-------------------------------------------\n\nTo grant users permission to access\na specific managed notebooks instance,\nset an [IAM policy](/iam/docs/policies) on the instance.\n\nTo grant a role to a principal on\na managed notebooks instance, use the\n[`getIamPolicy`](/vertex-ai/docs/workbench/reference/rest/v1/projects.locations.runtimes/getIamPolicy)\nmethod to retrieve the current policy,\nedit the current policy's access, and then use the\n[`setIamPolicy`](/vertex-ai/docs/workbench/reference/rest/v1/projects.locations.runtimes/setIamPolicy)\nmethod to update the policy on the instance.\n\n### Retrieve the current policy\n\n\nBefore using any of the request data,\nmake the following replacements:\n\n- \u003cvar translate=\"no\"\u003eINSTANCE_NAME\u003c/var\u003e: The name of your managed notebooks instance\n\n\nHTTP method and URL:\n\n```\nGET https://notebooks.googleapis.com/v1/INSTANCE_NAME:getIamPolicy\n```\n\nTo send your request, choose one of these options: \n\n#### curl\n\n| **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) , or by using [Cloud Shell](/shell/docs), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nExecute the following command:\n\n```\ncurl -X GET \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n \"https://notebooks.googleapis.com/v1/INSTANCE_NAME:getIamPolicy\"\n```\n\n#### PowerShell\n\n| **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nExecute the following command:\n\n```\n$cred = gcloud auth print-access-token\n$headers = @{ \"Authorization\" = \"Bearer $cred\" }\n\nInvoke-WebRequest `\n -Method GET `\n -Headers $headers `\n -Uri \"https://notebooks.googleapis.com/v1/INSTANCE_NAME:getIamPolicy\" | Select-Object -Expand Content\n```\nThe response is the text of your instance's IAM policy. See the following for an example.\n\n```\n{\n \"bindings\": [\n {\n \"role\": \"roles/notebooks.viewer\",\n \"members\": [\n \"user:email@example.com\"\n ]\n }\n ],\n \"etag\": \"BwWWja0YfJA=\",\n \"version\": 3\n}\n```\n\n### Edit the policy\n\nEdit the policy with a text editor to add or remove principals and their\nassociated roles. For example, to grant the `notebooks.admin` role to\neve@example.com, add the following new binding to the policy\nin the `\"bindings\"` section: \n\n {\n \"role\": \"roles/notebooks.admin\",\n \"members\": [\n \"user:eve@example.com\"\n ]\n }\n\nAfter adding the new binding, the policy might look like the following: \n\n {\n \"bindings\": [\n {\n \"role\": \"roles/notebooks.viewer\",\n \"members\": [\n \"user:email@example.com\"\n ]\n },\n {\n \"role\": \"roles/notebooks.admin\",\n \"members\": [\n \"user:eve@example.com\"\n ]\n }\n ],\n \"etag\": \"BwWWja0YfJA=\",\n \"version\": 3\n }\n\n### Update the policy on the instance\n\nIn the body of the request, provide the updated IAM\npolicy from the previous step, nested inside a `\"policy\"` section.\n\n\nBefore using any of the request data,\nmake the following replacements:\n\n- \u003cvar translate=\"no\"\u003eINSTANCE_NAME\u003c/var\u003e: The name of your managed notebooks instance\n\n\nHTTP method and URL:\n\n```\nPOST https://notebooks.googleapis.com/v1/INSTANCE_NAME:setIamPolicy\n```\n\n\nRequest JSON body:\n\n```\n{\n \"policy\": {\n \"bindings\": [\n {\n \"role\": \"roles/notebooks.viewer\",\n \"members\": [\n \"user:email@example.com\"\n ]\n },\n {\n \"role\": \"roles/notebooks.admin\",\n \"members\": [\n \"user:eve@example.com\"\n ]\n }\n ],\n \"etag\": \"BwWWja0YfJA=\",\n \"version\": 3\n }\n}\n```\n\nTo send your request, choose one of these options: \n\n#### curl\n\n| **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) , or by using [Cloud Shell](/shell/docs), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nSave the request body in a file named `request.json`,\nand execute the following command:\n\n```\ncurl -X POST \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json; charset=utf-8\" \\\n -d @request.json \\\n \"https://notebooks.googleapis.com/v1/INSTANCE_NAME:setIamPolicy\"\n```\n\n#### PowerShell\n\n| **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nSave the request body in a file named `request.json`,\nand execute the following command:\n\n```\n$cred = gcloud auth print-access-token\n$headers = @{ \"Authorization\" = \"Bearer $cred\" }\n\nInvoke-WebRequest `\n -Method POST `\n -Headers $headers `\n -ContentType: \"application/json; charset=utf-8\" `\n -InFile request.json `\n -Uri \"https://notebooks.googleapis.com/v1/INSTANCE_NAME:setIamPolicy\" | Select-Object -Expand Content\n```\n\nYou should receive a successful status code (2xx) and an empty response.\n\n### Grant access to the JupyterLab interface\n\nGranting a principal access to\na managed notebooks instance doesn't grant\nthe ability to use the instance's JupyterLab interface.\nTo grant access to the JupyterLab interface, see [Manage access to a\nmanaged notebooks instance's\nJupyterLab interface](/vertex-ai/docs/workbench/managed/manage-access-jupyterlab).\n\nWhat's next\n-----------\n\n- [Grant a principal access to\n JupyterLab.](/vertex-ai/docs/workbench/managed/manage-access-jupyterlab)\n\n- To learn about Identity and Access Management (IAM) and how\n IAM roles can help grant and restrict access,\n see the [IAM documentation](/iam/docs).\n\n- Learn about the [IAM roles available\n to Vertex AI Workbench\n managed notebooks](/vertex-ai/docs/workbench/managed/access-control).\n\n- Learn how to create and manage\n [custom roles](/iam/docs/creating-custom-roles).\n\n- To learn how to grant access to other Google resources, see\n [Manage access to\n other resources](/iam/docs/granting-changing-revoking-access)."]]