google-cloud-platform

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

Solution

  • I think there's no quick way like you mentioned with --organization arg, but that could be accomplished with, for example, the following UNIX-like script:

    for project_id in $(gcloud projects list --format='value(project_id)'); do
      org_id=$(gcloud projects describe $project_id --format='value(parent.id)')
      if [ $org_id -eq $the_org_you_want_to_find_out ]; then
       echo "$org_id > $project_id"
      fi
    done