Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to list all projects in GCP that belongs to a specific organization

gcloud allows you to list organization, folders or projects. I didn't found a option to list projects inside a organization.

Something like:

gcloud projects list --organization=ORG
like image 786
Ramon Medeiros Avatar asked Oct 30 '25 07:10

Ramon Medeiros


1 Answers

You can use Cloud Asset inventory. The base query is the following:

gcloud beta asset search-all-resources \
--asset-types=cloudresourcemanager.googleapis.com/Project \
--scope=organizations/920778098964

You can play with page size if you want to have a long list of results. More details here

I personally prefer to export to BigQuery all the assets and then query what I want in it. Project, but also VM, firewall rules,....

like image 96
guillaume blaquiere Avatar answered Nov 01 '25 07:11

guillaume blaquiere



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!