Use this script to update the billing account on one or more GCP projects. You can either set an individual project or specify a list file.
- Bash terminal
- Google Cloud SDK (CLI version): https://cloud.google.com/sdk/docs/install
- Credentials setup in the CLI with the appropriate permissions on target projects - either Project Owner or Project Billing Manager
- Download the raw scipt
gcp-bulk-billing-update.sh
- Set the file to be executable
chmod +x ./gcp-bulk-billing-update.sh
- [Optional] Create & activate a GCLOUD CLI configuration (https://cloud.google.com/sdk/docs/configurations) with the appropriate user who has the correct permissions
- Ensure you have the correct GCLOUD Configuration set (https://cloud.google.com/sdk/docs/configurations) - list your configurations with
gcloud config configurations lsit
- Create the project ids list file or have the single project id required
- Run the command with the appropriate parameters eg:
./gcp-bulk-billing-update.sh -b 0X0X0X-0X0X0X-0X0X0X -p my-first-project-123456
Parameters are as follows:
-b
or--billingAcc
(REQUIRED) The billing account to set the project to. Must be in the format 0X0X0X-0X0X0X-0X0X0X-p
or--project
(REQUIRED) The project to set the billing on (only required if file is not set)-f
or--file
(REQUIRED) The text file to use that has the list of project ids in it. Project ids should be on individual lines.