Monitoring billing for tenants
All tenants are billed as part of their Identity Platform project. This document explains how to export billing data and monitor the cost of individual tenants.
Before you begin
To export tenant billing data, you'll need to be granted the
IAM Owner role ( roles/owner 
) on the following:
- An Identity Platform project with multi-tenancy enabled.
- The billing account linked to your project.
Enabling billing export to BigQuery
To make billing data available in BigQuery, follow the steps in Export billing data to BigQuery .
You only need to complete the step once per project.
Querying billing data
-  Open the BigQuery page in the Google Cloud console. Go to the BigQuery page 
-  Select the table containing your project's billing information. 
-  Click Compose Queryto open the query editor. 
-  Enter a query. To list the total cost for each tenant, use the following, replacing dataset-name.table-namewith the name of the billing dataset and table you exported in step 1:SELECT labels . value as Tenant , SUM ( cost ) as TenantCost FROM [ dataset - name . table - name ] WHERE labels . key = "goog-identitytoolkit-tenant" GROUP BY 1All monthly active user reports have a start time at the beginning of the month. You can use WHERE usage_start_timeand the first day of the month (expressed in Pacific Time) to filter on a monthly basis. For example, to list the cost of each tenant for August 2019:SELECT labels . value as Tenant , SUM ( cost ) as TenantCost FROM [ dataset - name . table - name ] WHERE labels . key = "goog-identitytoolkit-tenant" AND usage_start_time = "2019-08-01 00:00:00 -07:00" GROUP BY 1You can also get the costs for one specific tenant. Replace tenant-idwith the ID of your tenant in the following example:SELECT labels . value as Tenant , SUM ( cost ) as TenantCost FROM [ dataset - name . table - name ] WHERE labels . key = "goog-identitytoolkit-tenant" AND labels . value = "tenant-id" GROUP BY 1
-  Click Run queryto execute it. 
You should see a billing breakdown specific to one particular tenant.

