[CLI] GCP Billing Account Onboarding for Target
The Target Company is required to implement the following steps within the GCP Cloud Shell. Please sign in to the GCP console using the Admin account where billing has been set up, and then initiate the Cloud Shell from the navigation bar.
To carry out below steps, Service account id is required. Please consult your partner company to share service account id before moving forward.
Please go through GCP Troubleshooting to determine its applicability before beginning the onboarding process.
In order to execute the below steps, you need to have owner role.
Step-1: Enable Billing Export
Unfortunately, activating billing export via CLI is not feasible. We recommend adhering to the manual steps provided in the referenced guide Enable Billing Export
Step-2: Create a custom BigQuery Role
gcloud iam roles create billingaccess --project=PROJECT_ID --title="billingaccess" --permissions=bigquery.jobs.create,resourcemanager.projects.get
Replace PROJECT_ID
with your actual GCP project ID. (Follow this instructions to get project id https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects
Step-3: Grant service account Access to the custom BigQuery role
Assign the custom role to the Service Account
gcloud projects add-iam-policy-binding PROJECT_ID --member="serviceAccount:SERVICE_ACCOUNT_ID" --role="projects/PROJECT_ID/roles/billingaccess" --condition=None
Replace SERVICE_ACCOUNT_ID
with Service Account Id shared by your partner, and PROJECT_ID
with your actual GCP project ID.
Step-4: Grant service account access to the dataset
gcloud projects add-iam-policy-binding PROJECT_ID --member="serviceAccount:SERVICE_ACCOUNT_ID" --role=roles/bigquery.dataViewer --condition=None
Replace SERVICE_ACCOUNT_ID
with Service Account Id shared by your partner
Step-5: Enable Cloud Resource Manager API
gcloud services enable cloudresourcemanager.googleapis.com
Step-6: Retrieve the Billing Account Id and Project Id
gcloud beta billing projects describe PROJECT_ID --format="value(billingAccountName.basename())"
PROJECT_ID
with your actual GCP project ID
Step-2: Capture the below details and share with your partner.
Account Id
Project Id
Dataset Name: Captured while performing in this step Enable Billing Export.
<<Previous ---------------------------------------------------------------------------------------------------------- Next>>