Manual
Create the Billing Project
Login to the Google Cloud Platform console.
In the
Project Pickermenu on top, create a project with the name “OneLens Billing Project”.
Using the
Project Pickermenu on top, open the newly created project "OneLens Billing Project".Using the search bar on top, search for and enable the
Cloud Billing APIon this project.
In the same way, search for and enable the
API Keys APIon this project.
Enable Detailed Usage Export
In the
Project Pickermenu on top, open the billing project created (OneLens Billing Project).In the left menu, open
BigQuery Studio.In the
BigQuery Explorerpane, click the3 dotsto the right of the billing project ID, and clickCreate dataset.
In the opened
Create datasetmenu, enter the following data:Under
Dataset ID, enter “billing_export”.Under
Location type, select Multi-region.Under
Multi-region, select US (multiple regions in the United States)
Under
Advanced options, make sure theEnable table expiryoption is unchecked.
Click
Create data set.
Go to
Billingon the left menu.Under
Cost management, selectBilling exportin the left menu.Enable
Detailed usage costwith the following options:Under
Projects, select the billing project created (OneLens Billing Project).Under
Dataset, select the dataset created (billing_export).Click
Save.
Enable CUD Export
Go to
Billingon the left menu.Under
Cost management, selectBilling exportin the left menu.Enable
Committed use discounts exportwith the following options:Under
Projects, select the billing project created (OneLens Billing Project).Under
Linked dataset name, enter a new dataset name: cud_export.Under
Location type, select Multi-region.Under
Multi-region, select US (multiple regions in the United States).Click
Save.

Create the Service Account and assign permissions on the Billing project
In the
Project Pickermenu on top, select the new billing project created just now (i.e., OneLens Billing Project)Go to
IAM and adminon the left bar.Go to
Service accountsand click on+ Create service account.Enter the
Service account nameas “OneLens Reader SA”Service account IDshould be automatically generated.Enter the
Service account descriptionas: SA used by OneLens with read-only roles for FinOps analysis.Click
Create and continue.
Under
Permissions, search for and select the following roles:BigQuery Data ViewerBigQuery Metadata ViewerBigQuery Job UserBigQuery Read Session User
Click
Continue
Click
DoneOn the left, under
IAM and admin, selectService AccountsSelect the service account that was created just now (i.e., OneLens Reader SA).
Under the
Principals with accesstab, click+ Grant access.Under
Add principals, enter the following valuesonelens-customer-sa@astuto-prod-mum.iam.gserviceaccount.com(our backend Service Account)onelens.finops@astuto.ai(our external user email)
Under
Assign Roles, add the following role:Service Account Token Creator
Click
Save.
Assign Billing project roles to the External User
In the
Project Pickermenu on top, select the new billing project created just now (i.e., OneLens Billing Project)Go to
IAM and adminand click+ Grant access.Under
Add principals, enter the value of theexternal user email IDprovided to you by the OneLens team:onelens.finops@astuto.aiUnder Assign Roles, add the following roles and click Save:
BigQuery Data ViewerBigQuery Metadata ViewerBigQuery Job User
Assign Organisation-level roles for Service Account and External User
Open the
Project Pickermenu and select yourorganisation.Go to
IAM and adminand click+ Grant access.Under
Add principals, search for and select theservice accountthat was created (i.e., OneLens Reader SA) and the external user email (i.e.,onelens.finops@astuto.ai)Under
Assign Roles, add the following roles and clickSave:Organisation ViewerCloud Asset ViewerBrowserBilling Account Viewer
Assign Organisation-level service roles to the Service Account
Open the
Project Pickermenu and select yourorganisation.Go to
IAM and adminand click+ Grant access.Under
Assign Roles, add the following roles:Vertex AI ViewerCloud Functions ViewerCloud SQL ViewerCompute ViewerKubernetes Engine ViewerDataflow ViewerDataproc ViewerCloud Filestore ViewerMonitoring ViewerNetwork Management ViewerRecommender ViewerCloud Memorystore Redis ViewerService Usage ViewerLogs ViewerStorage Bucket ViewerBigQuery Job UserBigQuery Metadata ViewerBigQuery Resource Viewer
Click
Save.

Assign Organisation-level service roles to the External User
Open the
Project Pickermenu and select yourorganisation.Go to
IAM and adminand click+ Grant access.Under
Add principals, enter and select the external user email (i.e.,onelens.finops@astuto.ai).Under
Assign Roles, add the following roles:ViewerBigQuery Resource ViewerBigQuery Metadata ViewerBigQuery Job User
Click
Save.
Create and assign the AI key inventory role
OneLens reports on the API keys and the service accounts in your organisation that can reach Vertex AI or Gemini, so they are visible alongside their cost. That needs three permissions: apikeys.keys.list returns a key's name, display name, API restrictions and creation time; cloudasset.assets.searchAllIamPolicies finds the IAM bindings that allow Vertex AI prediction; iam.serviceAccounts.get reads the ID, home project and disabled flag of each service account in those bindings.
Open the
Project Pickermenu and select yourorganisation.Go to
IAM and adminand selectRolesin the left menu.Click
+ Create custom roleand enter the following:Under
Title, enter OneLens AI Key Inventory.Under
Description, enter Lists API key metadata and Vertex AI service accounts for OneLens AI cost reporting. Cannot read key strings.Under
ID, enter onelensAiKeyInventory.Click
+ Add permissions, filter forapikeys.keys.list, tick it, and clickAdd.Repeat for
cloudasset.assets.searchAllIamPoliciesandiam.serviceAccounts.get. The role must list exactly these three permissions.Click
Create.

Go back to
IAM and adminand click+ Grant access.Under
Add principals, search for and select theservice accountthat was created (i.e., OneLens Reader SA).Under
Assign Roles, add the roleOneLens AI Key Inventoryand clickSave.
Last updated

