A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/colab/docs/run-code-adc below:

Access Google Cloud services and APIs

Access Google Cloud services and APIs Skip to main content

Stay organized with collections Save and categorize content based on your preferences.

Access Google Cloud services and APIs

This page describes how to access Google Cloud services and APIs through your Colab Enterprise notebook.

Overview

When you run code in a Colab Enterprise notebook, you can access Google Cloud services and APIs by using the credentials associated with your Google Account, also called user credentials. This means that the runtime that you use has the same level of access to Google Cloud that the user does. This makes it easier to write and run code that interacts with Google Cloud services and APIs.

Colab Enterprise can use Application Default Credentials (ADC) to authenticate your user credentials to Google Cloud services and APIs. This page describes the following ways to provide your user credentials to ADC:

Before you begin
  1. 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.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    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.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. Enable the Vertex AI, Dataform, and Compute Engine APIs.

    Enable the APIs

  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    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.

    Go to project selector

  6. Verify that billing is enabled for your Google Cloud project.

  7. Enable the Vertex AI, Dataform, and Compute Engine APIs.

    Enable the APIs

Required roles

To get the permissions that you need to access Google Cloud services and APIs in a Colab Enterprise notebook, ask your administrator to grant you the Colab Enterprise Admin (roles/aiplatform.colabEnterpriseAdmin) IAM role on the project. For more information about granting roles, see Manage access to projects, folders, and organizations.

You might also be able to get the required permissions through custom roles or other predefined roles.

Use a runtime with end-user credentials enabled

You can use the default runtime, which has end-user credentials enabled, or any runtime created from a runtime template in which end-user credentials are enabled.

If you don't have a sufficient runtime template with end-user credentials enabled, you must create one. You must enable or turn off end-user credentials when you create a runtime template. This setting can't be modified later.

Note: The first time that you connect to a runtime that has end-user credentials enabled, a dialog asks you to grant Colab Enterprise access to your user credentials. If you complete the dialog without granting access, you must take additional steps before you can successfully run code that interacts with Google Cloud services and APIs. See User credentials not found when running code. Connect to a runtime with end-user credentials enabled

To connect to a runtime with end-user credentials enabled:

  1. In the Google Cloud console, go to the Colab Enterprise My notebooks page.

    Go to My notebooks

  2. In the Region menu, select the region that contains your notebook.

  3. Click the notebook that you want to open. If you haven't created a notebook yet, create a notebook.

  4. In your notebook, click the Additional connection options expander arrow, and then select Connect to a runtime.

    The Connect to Vertex AI runtime dialog opens.

  5. For Select a runtime, select Connect to an existing runtime.

  6. For Select an existing runtime option, select the runtime that you want to connect to. If there aren't any runtimes in the list, create a runtime or connect to the default runtime.

  7. In the Runtime details table, verify that Personal credentials are Enabled.

  8. Click Connect.

  9. If this is your first time connecting to a runtime with end-user credentials enabled, a Sign in dialog appears.

    To grant Colab Enterprise access to your user credentials, complete the following steps:

    1. In the Sign in dialog, click your user account.

    2. Select See, edit, configure, and delete your Google Cloud data... to grant Colab Enterprise access to your user credentials.

    3. Click Continue.

When you access Google Cloud services and APIs by using end-user credentials, be aware that if your Google Account doesn't have the required Identity and Access Management (IAM) permissions in your project, your code might not be able to access some resources. If this happens, ask your administrator to grant you the required permissions.

Provide your user credentials to ADC by running code in your notebook

If your runtime doesn't have end-user credentials enabled, you can still use your user credentials to access Google Cloud services and APIs. To do so, provide your user credentials to ADC by using the Google Cloud CLI.

  1. Use the following command to create a credential file:

    !gcloud auth application-default login

    A Sign in dialog appears.

  2. Complete the dialog to grant Colab Enterprise access.

    After you sign in, your credentials are stored in the local credential file used by ADC. This file is stored on your runtime's VM.

When you provide user credentials to create a local ADC file, you should be aware of the following:

Troubleshoot

This section shows you how to resolve issues with running code that interacts with Google Cloud services and APIs.

User credentials not found when running code

This issue occurs when you try to run code in a notebook that interacts with Google Cloud services and APIs, but you haven't granted Colab Enterprise access to your user credentials.

The error message might look like one of the following:

Request had invalid authentication credentials.
Expected OAuth 2 access token, login cookie or other valid authentication credential
DefaultCredentialsError: Your default credentials were not found.

See the following common reasons for this issue and their resolutions:

What's next

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["Colab Enterprise allows access to Google Cloud services and APIs using the user credentials associated with your Google Account."],["Application Default Credentials (ADC) can authenticate your user credentials to Google Cloud services and APIs within Colab Enterprise notebooks."],["You can use a runtime with end-user credentials enabled, or provide your user credentials to ADC by running a command in your notebook, to interact with Google Cloud services."],["If you encounter errors when running code, ensure you've granted Colab Enterprise access to your user credentials through the Sign in dialog, check for pop-up blockers, and verify that the Colab service and service status are enabled for everyone in Google Workspace."],["If you do not wish to use the runtime end-user credentials, you can provide your user credentials to the ADC by using the Google Cloud CLI."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4