Manage Gemini Code Assist licenses

Before using Gemini Code Assist, each user in your organization needs a license.

By default, new subscriptions require you to manually assign licenses. After you set up certain Gemini for Google Cloud products, you can then choose to assign licenses manually or automatically.

Before you begin

  • Ensure that you have the Billing Account Administrator (roles/billing.admin) or Consumer Procurement Order Administrator (roles/consumerprocurement.orderAdmin) IAM roles so that you can grant additional permissions required on the billing account for specific license management tasks detailed in the following sections.
  • If you want to manage licenses using an API rather than the Google Cloud console, then ensure the following:

Change the number of Gemini Code Assist licenses in a subscription

You can add or remove the number of Gemini for Google Cloud licenses directly through the Google Cloud console, or through your Google account representative or an authorized reseller.

To change the number of licenses in a subscription, follow these steps:

  1. Ensure that you have the following Identity and Access Management (IAM) permissions on the billing account that owns the subscription:

    • billing.accounts.get
    • consumerprocurement.orders.get
    • consumerprocurement.orders.modify
    • resourcemanager.projects.get
  2. In the Google Cloud console, go to the Admin for Gemini page.

    Go to Admin for Gemini

  3. Choose the subscription that you want to change, and then select Modify Subscription.

  4. Enter the number of licenses that you want to have. The following information is displayed:

    • Number of total licenses after purchase.
    • Number of licenses available for assignment after purchase.
    • New subscription price per term. The additional amount for the added licenses is prorated based on how much time remains in the current term.
  5. Select Save.

View Gemini Code Assist license assignments

Select one of the following options:

Console

  1. Ensure that you have the following IAM permissions on the billing account that owns the subscription:

    • billing.accounts.get
    • consumerprocurement.orders.get
    • consumerprocurement.licensePools.get
    • consumerprocurement.licensePools.enumerateLicensedUsers
    • resourcemanager.projects.get
  2. Go to the Admin for Gemini page.

    Go to Admin for Gemini

  3. Choose the subscription that you want to change, and then select Modify Subscription.

    The following information is available for each user that has been assigned a license:

    • Name.
    • Email.
    • Date the license was assigned.
    • Date and time the licensed was last used.
  4. To find a specific set of users, you can filter and sort the list as follows:

    • To filter the list, in the Filter field, enter the properties and values.
    • To sort the list, select the heading of the column that you want to sort by. For example, to sort alphabetically by the user names, select the Name column heading.

API

To view Gemini Code Assist license assignments, use the billingAccounts.orders.licensePool.enumerateLicensedUsers method.

To perform this task, you must have the consumerprocurement.licensePools.enumerateLicensedUsers permission on the billing account that owns the subscription.

GET https://cloudcommerceconsumerprocurement.googleapis.com/v1/billingAccounts/BILLING_ACCOUNT_ID/orders/ORDER_ID/licensePool:enumerateLicensedUsers/

Replace the following:

  • BILLING_ACCOUNT_ID: the billing account ID
  • ORDER_ID: the IAM policy

If the command succeeds, it returns licensedUsers output in the following format:

{
  "licensedUsers": [
      {
          "username": "dana@example.com",
          "assignTime": "2024-09-26T16:24:40.559222Z"
      },
      {
          "username": "lee@example.com",
          "assignTime": "2024-09-26T16:24:40.559222Z"
      },
      {
          "username": "taylor@example.com",
          "assignTime": "2024-09-26T16:24:40.559222Z"
      },
      {
          "username": "bola@example.com",
          "assignTime": "2024-09-26T16:24:14.610828Z"
      }
  ]
}

If there are no Gemini Code Assist license assignments or the ORDER_ID is invalid, it returns licensedUsers output in the following format:

{}

Manually assign Gemini Code Assist licenses to individual users

Select one of the following options:

Console

  1. Ensure that you have the following IAM permissions on the billing account that owns the subscription:

    • billing.accounts.get
    • consumerprocurement.orders.get
    • consumerprocurement.licensePools.get
    • consumerprocurement.licensePools.enumerateLicensedUsers
    • consumerprocurement.licensePools.assign
    • resourcemanager.projects.get
  2. Go to the Admin for Gemini page.

    Go to Admin for Gemini

  3. Select Manage Gemini Code Assist, and then select Modify Subscription.

  4. For this Gemini Code Assist subscription, ensure that you set License Assignment to Manually Assign Licenses. If the Gemini Code Assist subscription is set to Automatically Assign Licenses, then you cannot manage individual licenses. Switching this billing account to Manually Assign Licenses turns off automatic license assignment after the change, but pre-existing license assignments are unaffected.

  5. Select Assign Licenses. A user selection dialog appears. To search for specific users, enter their email address and then select Next.

  6. Select Assign Licenses.

API

To assign Gemini Code Assist licenses, use the billingAccounts.orders.licensePool.assign method.

To perform this task, ensure you have the following permissions on the billing account that owns the subscription:

  • billing.accounts.get
  • consumerprocurement.licensePools.assign
  • consumerprocurement.licensePools.get
  • consumerprocurement.licensePools.unassign
  • consumerprocurement.orders.get
POST https://cloudcommerceconsumerprocurement.googleapis.com/v1/billingAccounts/BILLING_ACCOUNT_ID/orders/ORDER_ID/licensePool:assign/

{
  "usernames": [
            "dana@example.com",
            "lee@example.com"
  ]
}

Replace the following:

  • BILLING_ACCOUNT_ID: the billing account ID
  • ORDER_ID: the IAM policy

If the command succeeds, it returns an empty response body in the following format:

{}

To verify the assignment, view the list of assignments.

Automatically assign Gemini Code Assist licenses

You can automatically assign a license to any user in your organization who requires access to Gemini Code Assist from the License Assignment page. Automatic license assignment is set individually for each subscription.

If you choose to automatically assign licenses for a Gemini Code Assist, you can't remove or add individual user licenses under that account. Users with license assignments who haven't used any Gemini Code Assist features are automatically de-provisioned at the end of the billing period after a specified number of days of inactivity as set by the administrator.

  1. In the Google Cloud console, go to the Admin for Gemini page.

    Go to Admin for Gemini

  2. Select Manage Gemini Code Assist, and then select Manage Subscription.

  3. Select License Management, and then select Enable Automatic License Assignment. The Enable automatic licenses dialog appears.

    Switching this subscription to automatically assign licenses turns off manual license assignment after the change, but pre-existing license assignments are unaffected.

  4. Set the length of time for a license to unassign if the assignee is inactive, then select Confirm Change. The Automatic license assignment has been enabled dialog appears.

  5. Select Close.

As long as licenses are available for assignment, new users automatically receive a license when they first access Gemini Code Assist covered by your subscriptions in this billing account.

To disable automatic license assignment, follow these steps:

  1. In the Google Cloud console, go to the Admin for Gemini page.

    Go to Admin for Gemini

  2. Select Manage Gemini Code Assist, and then select Manage Subscription.

  3. Select License Management, and then select Manage Automatic License Assignment. The Manage automatic license assignment dialog appears.

  4. Select Disable automatic license management.

  5. Select Confirm change.

Manually unassign Gemini Code Assist licenses

Select one of the following options:

Console

  1. Ensure that you have the following IAM permissions on the billing account that owns the subscription:

    • billing.accounts.get
    • consumerprocurement.orders.get
    • consumerprocurement.licensePools.get
    • consumerprocurement.licensePools.enumerateLicensedUsers
    • consumerprocurement.licensePools.unassign
    • resourcemanager.projects.get
  2. Go to the Admin for Gemini page.

    Go to Admin for Gemini

  3. Select Manage Gemini Code Assist, and then select Manage Subscription.

  4. Select License Management, and then select Manage Automatic License Assignment. The Manage automatic license assignment dialog appears.

  5. Select the users for which you want to unassign licenses, then select Unassign License.

  6. Select Confirm.

API

To unassign Gemini Code Assist licenses, use the billingAccounts.orders.licensePool.unassign method.

To perform this task, you must have the consumerprocurement.licensePools.unassign permission on the billing account that owns the subscription.

POST https://cloudcommerceconsumerprocurement.googleapis.com/v1/billingAccounts/BILLING_ACCOUNT_ID/orders/ORDER_ID/licensePool:unassign/

{
  "usernames": [
            "dana@example.com",
            "lee@example.com"
  ]
}

Replace the following:

  • BILLING_ACCOUNT_ID: the billing account ID
  • ORDER_ID: the IAM policy

If the command succeeds, it returns an empty response body in the following format:

{}

To verify the unassignment, view the list of assignments.

Transfer Gemini Code Assist licenses

Gemini Code Assist licenses cannot be transferred directly between users. Instead, unassign the license from a user and then assign a license to the new user.

Prevent cross-organization license usage

Gemini Code Assist licenses are assigned to individual users, not organizations or projects, allowing individual users to use Gemini Code Assist across multiple organizations.

Any logs generated from Gemini Code Assist usage sit with the project in which the usage occurred, and not with the licensee. Additionally, any customization or configuration of Gemini Code Assist (such as code customization) is done on the project, not at the license or subscription level.

To further prevent cross-organization usage of Gemini Code Assist in a project, you can do one of the following:

  • Disable the Gemini for Google Cloud API in the project.
  • Use permissions to deny user access to the project.

Limitations