Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Créer une instance avec accès aux identifiants utilisateur
Cette page explique comment créer une instance Vertex AI Workbench qui accède aux services et aux API Google Cloud avec vos identifiants utilisateur.
Vos identifiants utilisateur sont ceux associés à votre compte Google.
Vos identifiants utilisateur déterminent les services et les API auxquels votre compte Google a accès. Google Cloud
Par défaut, lorsque vous exécutez du code dans une instance Vertex AI Workbench, votre instance peut accéder aux services et aux API Google Cloud en utilisant les identifiants associés au compte de service de votre instance. Cela signifie que votre instance dispose du même accès à Google Cloud que le compte de service.
Cette page explique comment créer et configurer une instance pour qu'elle ait le même accès à Google Cloud que vos identifiants utilisateur.
Présentation
Vertex AI Workbench utilise un client OAuth géré par Google au niveau mondial pour gérer l'accès aux identifiants utilisateur, limité aux ressources Google Cloud du projet de l'utilisateur. Les utilisateurs doivent autoriser le client OAuth à gérer leurs identifiants pour chaque instance Vertex AI Workbench.
Cette opération est effectuée une seule fois par instance via une boîte de dialogue qui s'ouvre lorsque vous cliquez sur le bouton Ouvrir JupyterLab dans la console Google Cloud .
Le compte de service utilisé pour créer l'instance Vertex AI Workbench est l'agent de service suivant :
Cet agent de service fournit des autorisations limitées pour les services essentiels tels que l'exportation de journaux. Les utilisateurs ne peuvent pas spécifier un autre compte de service si la fonctionnalité d'identifiants de l'utilisateur final est activée.
Les instances pour lesquelles les identifiants de l'utilisateur final sont activés comportent le libellé Compute Engine notebooks-managed-euc: true et la clé de métadonnées euc-enabled: true associés à la ressource de VM pour indiquer que la fonctionnalité est activée.
Limites
Tenez compte des limites suivantes lorsque vous planifiez votre projet :
Vertex AI Workbench utilise un client OAuth géré par Google au niveau mondial pour gérer l'accès aux identifiants utilisateur. Les organisations ne peuvent pas appliquer de contrôles précis, accéder au client OAuth ni utiliser la journalisation pour vérifier l'utilisation du client OAuth.
Pour protéger la sécurité des instances Vertex AI Workbench avec des identifiants utilisateur gérés, les utilisateurs ne peuvent pas :
Utilisez SSH pour accéder à l'instance.
Exécutez un script post-démarrage.
Accédez à la page d'informations détaillées sur la VM.
Utilisez une image qui n'a pas été créée par Google.
L'utilisation d'identifiants tiers n'est pas prise en charge, car le client OAuth n'accepte que les identifiants OAuth gérés par Google.
Avant de commencer
Sign in to your Google Cloud account. If you're new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
Pour obtenir les autorisations nécessaires pour créer une instance Vertex AI Workbench, demandez à votre administrateur de vous accorder le rôle IAM Exécuteur de notebooks (roles/notebooks.runner) sur le projet.
Pour en savoir plus sur l'attribution de rôles, consultez la page Gérer l'accès aux projets, aux dossiers et aux organisations.
Dans la boîte de dialogue Nouvelle instance, cliquez sur Options avancées.
Dans la boîte de dialogue Créer une instance, dans la section Détails, fournissez les informations suivantes pour la nouvelle instance :
Nom : donnez un nom à la nouvelle instance. Il doit commencer par une lettre, suivie de 1 à 62 caractères (lettres minuscules, chiffres ou traits d'union). Il ne peut pas se terminer par un trait d'union.
Région et Zone : sélectionnez une région et une zone pour la nouvelle instance. Pour obtenir les meilleures performances réseau, sélectionnez la région la plus proche de vous géographiquement.
Consultez les emplacements Vertex AI Workbench disponibles.
Dans la section IAM et sécurité, sélectionnez Un seul utilisateur.
Dans le champ Adresse e-mail de l'utilisateur, saisissez le compte utilisateur auquel vous souhaitez accorder l'accès. Si l'utilisateur spécifié n'est pas le créateur de l'instance, vous devez lui attribuer le rôle Utilisateur du compte de service (roles/iam.serviceAccountUser) sur le compte de service de l'instance.
Sélectionnez Activer les identifiants gérés de l'utilisateur final.
Renseignez le reste de la boîte de dialogue de création d'instance, puis cliquez sur Créer.
Vertex AI Workbench crée une instance et la démarre automatiquement.
Lorsque l'instance est prête à l'emploi, Vertex AI Workbench active un lien Ouvrir JupyterLab dans la console Google Cloud .
Les utilisateurs doivent autoriser le client OAuth à gérer leurs identifiants pour chaque instance Vertex AI Workbench. Cette opération est effectuée une seule fois par instance. Pour accorder votre consentement, cliquez sur Ouvrir JupyterLab et remplissez la boîte de dialogue qui s'affiche.
Si vous essayez d'accéder à l'instance sans donner votre consentement, JupyterLab affiche un message vous invitant à vous authentifier en ouvrant JupyterLab depuis la consoleGoogle Cloud .
Pour vérifier que vos identifiants d'utilisateur final sont disponibles dans JupyterLab, ouvrez un terminal dans JupyterLab et saisissez la commande suivante :
gcloudauthlist
Authentifiez l'instance avec vos identifiants utilisateur.
Vertex AI Workbench peut utiliser les Identifiants par défaut de l'application (ADC) pour authentifier vos identifiants utilisateur auprès des services et des API Google Cloud .
Cette section explique comment fournir vos identifiants utilisateur à ADC si l'une des limites vous empêche d'activer les identifiants gérés.
La procédure d'authentification varie selon que vous utilisez un compte Google ou des identifiants tiers.
Compte Google
Une fois que vous pouvez accéder à JupyterLab sur votre instance, procédez comme suit :
Dans la console Google Cloud , accédez à la page Instances.
Ouvrez JupyterLab à l'aide du proxy JupyterLab fédéré.
Dans JupyterLab, sélectionnez Fichier > Nouveau > Terminal.
Créez un fichier d'identifiants pour la fédération d'identité de personnel avec la connexion sans interface graphique.
Dans la fenêtre de terminal, exécutez la commande suivante :
gcloudauthlogin--cred-file="CREDENTIAL_FILE"
Remplacez CREDENTIAL_FILE par le chemin d'accès et le nom du fichier d'identifiants que vous avez créé.
Suivez les instructions pour vous authentifier via le portail d'authentification tiers.
Vérifiez que vos identifiants sont accessibles via votre instance à l'aide de la commande suivante :
gcloudauthlist
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[],[],null,["Create an instance with user credential access\n| **Preview**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nThis page describes how to create a Vertex AI Workbench instance that\naccesses Google Cloud services and APIs through your user credentials.\n\nYour user credentials are the credentials associated with your Google Account.\nYour user credentials determine which Google Cloud services and APIs your\nGoogle Account has access to.\n\nBy default, when you run code in a Vertex AI Workbench instance,\nyour instance can access Google Cloud services and APIs by using\nthe credentials associated with your instance's service account. This\nmeans that your instance has the same access to Google Cloud as\nthe service account.\n\nThis page describes how to create and configure an instance so that it\nhas the same access to Google Cloud as your user credentials.\n\nOverview\n\nVertex AI Workbench uses a global google-managed OAuth client\nto manage user credential access, scoped for the Google Cloud resources\nin the user's project. Users must grant consent to the OAuth Client to\nmanage their credentials for each Vertex AI Workbench instance.\nThis is done one time per instance through a dialog that opens when\nyou click the **Open JupyterLab** button in the Google Cloud console.\n\nThe service account used to create the Vertex AI Workbench instance is the\nfollowing service agent:\n\n`service-`\u003cvar translate=\"no\"\u003ePROJECT_NUMBER\u003c/var\u003e`@gcp-sa-notebooks-vm.``iam.``gserviceaccount.``com`.\n\nThis service agent provides limited permissions for essential services such\nas exporting logs. Users can't specify a different service account\nif the end user credentials feature is enabled.\n\nInstances with end user credentials enabled have the `notebooks-managed-euc: true`\nCompute Engine label and the `euc-enabled: true` metadata key\nattached to the VM resource to denote the feature enablement.\n\nLimitations\n\nConsider the following limitations when you plan your project:\n\n- Vertex AI Workbench uses a global google-managed OAuth client\n to manage user credential access. Organizations can't\n enact fine grain controls, access the OAuth client, or use logging\n to check for use of the OAuth client.\n\n- To protect the security of Vertex AI Workbench instances with\n managed user credentials, **users aren't able to**:\n\n - Use SSH to access the instance.\n - Run a post-startup script.\n - Access the detailed VM page.\n - Use an image that isn't created by Google.\n- Using [third party\n credentials](/vertex-ai/docs/workbench/instances/create-third-party-instance)\n isn't supported because the OAuth client only supports Google-managed\n OAuth credentials.\n\nBefore you begin\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Notebooks API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=notebooks.googleapis.com&redirect=https://console.cloud.google.com)\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Notebooks API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=notebooks.googleapis.com&redirect=https://console.cloud.google.com)\n\n\u003cbr /\u003e\n\nRequired roles\n\n\nTo get the permissions that\nyou need to create a Vertex AI Workbench instance,\n\nask your administrator to grant you the\n\n\n[Notebooks Runner](/iam/docs/roles-permissions/notebooks#notebooks.runner) (`roles/notebooks.runner`)\nIAM role on the project.\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nYou might also be able to get\nthe required permissions through [custom\nroles](/iam/docs/creating-custom-roles) or other [predefined\nroles](/iam/docs/roles-overview#predefined).\n\nCreate a single user instance\n\nTo create a Vertex AI Workbench instance by using\nthe Google Cloud console, do the following:\n\n1. In the Google Cloud console, go to the **Instances** page.\n\n [Go to Instances](https://console.cloud.google.com/vertex-ai/workbench/instances)\n2. Click add_box **Create new**.\n\n3. In the **New instance** dialog, click **Advanced options**.\n\n4. In the **Create instance** dialog, in the **Details** section,\n provide the following information for your new instance:\n\n - **Name**: Provide a name for your new instance. The name must start with a letter followed by up to 62 lowercase letters, numbers, or hyphens (-), and cannot end with a hyphen.\n - **Region** and **Zone** : Select a region and zone for the new instance. For best network performance, select the region that is geographically closest to you. See the available [Vertex AI Workbench\n locations](/vertex-ai/docs/general/locations#instances).\n5. In the **IAM and Security** section, select **Single user**.\n\n6. In the **User email** field,\n enter the user account that you want to grant access. If the\n specified user is not the creator of the instance, you must grant\n the specified user the [Service Account User\n role](/iam/docs/service-account-permissions#user-role)\n (`roles/iam.serviceAccountUser`) on the instance's service account.\n\n7. Select **Enable managed end user credentials**.\n\n8. Complete the rest of the instance creation dialog, and then\n click **Create**.\n\n Vertex AI Workbench creates an instance and automatically starts it.\n When the instance is ready to use, Vertex AI Workbench\n activates an **Open JupyterLab** link in the Google Cloud console.\n9. Users must grant consent to the OAuth client to manage their credentials\n for each Vertex AI Workbench instance. This is done one time\n per instance. To grant consent, click **Open JupyterLab** and complete\n the dialog that appears.\n\n If you try to access the instance without granting consent, JupyterLab\n displays a message to authenticate by opening JupyterLab from the\n Google Cloud console.\n10. To verify that your end user credentials are available within JupyterLab,\n open a Terminal in JupyterLab, and enter the following command:\n\n ```bash\n gcloud auth list\n ```\n\nAuthenticate the instance with your user credentials\n\nVertex AI Workbench can use Application Default Credentials (ADC)\nto authenticate your user credentials to Google Cloud services and APIs.\nThis section describes how to provide your user credentials to ADC if any of\nthe limitations prevent you from enabling managed credentials.\n\nThe authentication steps depend on whether you are using a Google Account\nor third party credentials. \n\nGoogle Account\n\nAfter you can access JupyterLab on your instance, do the following:\n\n1. In the Google Cloud console, go to the **Instances** page.\n\n [Go to Instances](https://console.cloud.google.com/vertex-ai/workbench/instances)\n2. Next to your instance's name, click **Open JupyterLab**.\n\n3. In JupyterLab, select\n **File \\\u003e New \\\u003e Terminal**.\n\n4. In the terminal window, run the following:\n\n ```bash\n gcloud auth login\n ```\n5. Enter `Y`.\n\n6. Follow the instructions to copy a verification code and enter it into\n the terminal.\n\nThird party credentials\n\nIf you [created an instance with\nthird party credentials](/vertex-ai/docs/workbench/instances/create-third-party-instance),\nthen after the JupyterLab proxy is available, do the following:\n\n1. Open JupyterLab by using the federated JupyterLab proxy.\n\n2. In JupyterLab, select\n **File \\\u003e New \\\u003e Terminal**.\n\n3. Create a Workforce Identity Federation\n [credential file](/iam/docs/workforce-sign-in-okta) with headless sign-in.\n\n4. In the terminal window, run the following:\n\n ```bash\n gcloud auth login --cred-file=\"\u003cvar translate=\"no\"\u003eCREDENTIAL_FILE\u003c/var\u003e\"\n ```\n\n Replace \u003cvar translate=\"no\"\u003eCREDENTIAL_FILE\u003c/var\u003e with the path and name of the\n credential file that you created.\n5. Follow the instructions to authenticate through the\n third party authentication portal.\n\n6. Confirm that your credentials are accessible through your instance\n by using the following command:\n\n ```bash\n gcloud auth list\n ```"]]