I am new to GCP
I am trying to connect Google Project to other Billing Account
For example if i have Google map project in my account then i want to connect this map project with billing account which on another login.
How can i do that?
Is that possible?
I have tried but stuck on creating IAM and json file on billing account
below is the code i am using
setApplicationName(‘Google Cloud Billing API PHP Quickstart’);
$client->useApplicationDefaultCredentials();
$client->addScope(GoogleServiceCloudbilling::CLOUD_BILLING);$billingService = new Cloudbilling($client);
$billingProjectName = “projects/{$projectId}/billingInfo”;
$billingInfo = new CloudbillingProjectBillingInfo([
‘billingAccountName’ => $billingAccountName
]);try {
$response = $billingService->projects->updateBillingInfo($billingProjectName, $billingInfo);
printf(“Project %s is now linked to billing account %sn”, $projectId, $response->getBillingAccountName());
catch (Exception $e) {
echo ‘Error: ‘ . $e->getMessage();
}
}Replace with your project ID and billing account ID
$projectId = ‘your-project-id’;
$billingAccountName = ‘billingAccounts/your-billing-account-id’;linkBillingAccount($projectId, $billingAccountName);
?>
I don’t know what settings i need to update on both google account
Need little guidance on linking billing account and external GCP project via php api
Vishal Chauhan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.