Written by Paul Ogier on September 22, 2021

Installing GAMADV-XTD3 on Google Cloud Shell

This lesson is part of the "TAMING GAM - A practical guide to GAM and GAMADV-XTD3" course.

In this video, we will be walking through the set up of GAMADV-XTD3 on a Google Cloud Shell. You can either watch the video below, or follow the images and steps detailed below.

If you are trying to install GAM on another operating system, please refer to these articles:

GAMADV-XTD3 on Windows 10

GAMADV-XTD3 on Ubuntu Linux


Are you however trying to just upgrade your installation of GAM?

Let's get started.

If you would like to try it yourself, you can start here.

Login to Google Cloud Shell

Firstly open Google Cloud Shell

Google Cloud Shell -Accept Permissions

Accept any permissions that are requested when you get to the URL.

Wait for the Google Cloud Shell Provisioning

Download And Install GAMADV-XTD3

Let's download the installation of GAMADV-XTD3 from the GitHub Releases page.


We need to install GAMADV-XTD3 in the terminal, so please run this command.

bash <(curl -s -S -L https://git.io/fhZWP)
GAMADV-XTD3 is now installed on teh cloud shell. Can you run a full browser on this machine

GAMADV-XTD3 is now installed on this shell. It then asks if you can run a full browser on this machine. You can't, so press N and enter.

The next question is whether you are ready to set up a Google API Project for GAM. We are going to press Y and enter.

Then enter your Google Workspace admin email.

Go to the following link to authorise the GAM API

You will see that files and folders have been created:

.gam and .gam/gamcache and Downloads

Also gam.cfg has been initialised.

However, there are a few files and folders missing. client_secrets.json oauth2.txt and oauth2service.json are not found.

Click or copy the URL that has been generated and paste it into a browser.

Sign in with an admin account and grant permissions.

GAM Project Creation permissions

Then copy the code and paste it into your terminal.

gam code
paste the gam code into the terminal

Once you run this, it starts enabling the APIs for your GAM Project.

Google APIs are created by GAM

The APIs have been enabled. Now click or copy the URL to create a Desktop App.

Go to URL to create the desktop app

You need to create the Desktop App. You can name the OAuth 2.0 client whatever makes sense to you. I have named mine "GAM Cloud Shell" so it is easy for me to find later.

create oauth client id for the desktop app

Once you click create, you will be presented with a Client ID and a Client Secret. These need to be pasted into the Cloud Shell in the respective positions.

oauth client secret and client id

The Project Creation is now complete. We now need to authorise GAM to perform Google Workspace management operations with the admin account. Press Y and enter.

We now need to authorise GAM to perform Google Workspace management operations with the admin account. Press Y and enter.

You will now need to select the APIs that you want to enable. If you want all of them, just select S or, if you are happy with the scopes, then press C and enter.

select the APIs that you want to enable

You will now be presented with a very long URL. This URL can also be found in the path in your shell. Mine is under /home/michael/bin/gamadv-xtd3/gamoauthurls.txt. Depending on how you are working, it might be easier to copy and paste it from there. In Google Cloud Shell, it normally allows you to click on the URL.

click url to enable the APIs

If the URL worked, then you will be asked to login to your admin account to allow the API scopes.

press allow for all the api scopes

Next you will be asked to copy and paste the code back into the terminal under the Verification Code.

copy and paste the code into the terminal

That completes the Admin Authorisation. The oauth2.txt file has been created. You need to now authorise GAM to manage the Google Workspace user data and settings by pressing Y and enter. Then enter an email of a regular Workspace user, not the admin account.

domain-wide delegation authentication fails

The Domain-Wide Delegation for the admin user on the regular user, fails. This is an expected result. It is really just testing all the APIs. You will need to add the permissions to this in the next step.

apis failed click the URL and then authorise again

Click on the link to open the browser and authorise the permissions.

We need to add a new client ID and click the authorise button. Then return to the terminal and reauthorise.

add new client id with all the scopes

Below you will see the completed installation.

  1. All API Scopes have passed
  2. You will see your Service Account Client Name
  3. The gam.cfg file is saved into that path
  4. To start working with GAMADV-XTD3, you need to restart the terminal shell using the command in green
gam installation complete and passed service account path to gamadv-xtd3

Now to test

Now run this to test that you are connected to your domain.

gam info domain
gam info domain

Congratulations, you are ready to run GAMADV-XTD3! You might also want to check out how to install GAM on Ubuntu to see how to add aliases and paths.

(Optional) Additional things you can run.

There are some other commands that can be run.

Additional Options

gam config customer_id xxxx domain xxxx.com timezone local save verify

What is next?

Well done on completing this quick lesson on how to get GAM set up for your domain on Google Cloud Shell. 

Understanding the full capabilities of how to use GAM and GAMADV-XTD3 for your Google Workspace will increase your productivity and efficiency. Check out this full course of over 9 hours and 50 pages of free resources!

Related Posts