⚙️ How to create service accounts (sa)

⚙️ How to create service accounts (sa)

MsGsuite



❓ Why are service accounts useful ❔

The service accounts can be used to bypass the 750Gb/day upload limit set by google in google drive. It means that you can use them to upload more than 750Gb per day, duplicate hundreds of files...

Each service account has a 750Gb upload limit per day. You can create up to 100 service account per google cloud project. So, with only one project you can upload/duplicate up to 75Tb a day!



⚙️ How to create the accounts


🎬 Video tutorial : https://drive.google.com/file/d/1PMuKHwgHeMmM-MsBQEAAswicw31jDYp1/view?usp=sharing


  • Go to the Google Cloud Console and if you don't have an existing project, create a new one
  • Then, enable the google drive api
  • Go to the OAuth Consent Screen and select "External" and click on "Create"
  • Fulfill all required informations (the one with a red *) and click on "Save and Continue" 3 times (the "Scopes" and "Test users" parts do not require any inputs)
  • Click on publish and validate
  • On the credentials tab, click on "Create Credentials" then "OAuth client ID", select "Desktop app"
  • Click on the download button on the right of your OAuth Client IDs and save the file with the following name : credentials.json
  • Download and install python on your computer and then download this script into the same folder than the credentials.json file.
  • Create a folder named "accounts" (the generated accounts will be downloaded there)
  • To make the script work, download the requirements.txt file and run pip3 install -U -r requirements.txt
  • To create the accounts, you have different choices, but remember that a single sa can copy 750Gb a day and 1 project makes 100 sa so 750*100 = 75Tb a day. Creating too much sa accounts is useless.
If you want to create some service accounts using existing projects (do not create more projects), run py gen_sa_accounts.py --quick-setup -1

⚠️ This will overwrite the existing service accounts.


To create service accounts by creating a new project run : py gen_sa_accounts.py --quick-setup 1 replace "1" with the number of projects you want

⚠️This command creates services accounts in all existing projects even the projects that will be deleted.

  • After executing the code, follow the instructions...

If everything goes right, you should have at least 100 files into your "account" folder. Each file correspond to one service account.




📦 Add service accounts into a shared drive (team drive)

  • In order to manage the files (copy, duplicate...) into your shared drives with the service accounts, you must create a google group (configure it as you which)



Now, to get the email adresses of the service accounts, there is multiple ways to do it :

1️⃣ Method 1 :

Windows users
  • Open PowerShell and cd into folder the where you have the sa (the .json files)
  • Run : $emails = Get-ChildItem .\**.json |Get-Content -Raw |ConvertFrom-Json |Select -ExpandProperty client_email >>emails.txt
Linux / MacOs users
  • Run : grep -oPh '"client_email": "\K[^"]+' *.json > emails.txt
Now for everyone :
  • Open the emails.txt file, copy all the email adresses and add them into the google group you've just created.

Note : You can add only 100 sa/members each 24h in a google group.

  • Now add your google group email address to your team drive !


2️⃣ Method 2 :

  • Add the Email Extractor extension into your browser : Chrome | FireFox
  • Go to the google cloud console, select your project with the service accounts and go to the credentials tab (you should see the service accounts)
  • Scroll into the bottom of the page and under "Rows per page:" select 100
  • Open the extension and copy all the email adresses (except yours) and add them into the google group you've just created.
You can add only 100 sa/members each 24h in a google group.
  • Now add your google group email address to your team drive !



📢 Follow us :

Team drive generator : https://td.msgsuite.workers.dev/

Telegram channel : https://t.me/MsGsuite

Telegram chat : https://t.me/MsGsuiteChat


Tutorials index : https://telegra.ph/MsGsuite---Index-03-31



❤️ Credits & thanks :


Report Page