Join our Newsletter — 33% off our NHI Course
Home› Guides› Cloud Asset Inventory Guide: Searching Resources and IAM…
Guide Cloud Security

Cloud Asset Inventory Guide: Searching Resources and IAM Across an Organisation

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 13 min read
On this page

Security teams cannot protect Google Cloud resources and identities they cannot find, and in a large organisation those are spread across hundreds of projects and folders. Cloud Asset Inventory is the Google Cloud service that holds metadata for resources, IAM allow policies, organisation policies and access policies across an organisation, and lets you search, export and watch that metadata from one place. This guide shows how to use it for security work: the queries that find risky grants and service accounts, the permissions the caller needs at organisation scope, exports to BigQuery, Pub/Sub feeds for change detection and Policy Analyzer for effective access. It is written for Google Cloud security and platform engineers. For the wider platform baseline, see the Google Cloud Security Guide.

This is an independent guide from NHI Mgmt Group, based on Google Cloud's public documentation as of November 2026. It is not sponsored or reviewed by Google. Product features change, so confirm settings against Google Cloud's current documentation.

Key takeaways

  • Search at organisation scope. Run searches with --scope=organizations/ORGANIZATION_ID so one query covers every folder and project, rather than looping over projects.
  • Grant read access deliberately. Cloud Asset Viewer at organisation level lets a principal read IAM policies and resource metadata everywhere, so treat it as a sensitive role for people and automation alike.
  • Search shows direct grants, Policy Analyzer shows effective access. searchAllIamPolicies returns the bindings written on each resource; Policy Analyzer resolves inheritance, groups and roles into who can actually do what.
  • Feeds turn inventory into detection. A feed publishes every matching change to a Pub/Sub topic, with the prior state attached, so new owner grants, public bindings or service account keys can raise alerts within minutes.
  • It is the best starting point for NHI discovery. Service accounts, service account keys, API keys and the bindings that grant them access are all searchable asset types.

What Cloud Asset Inventory is

Google describes Cloud Asset Inventory as a global metadata inventory service to view, search, export, monitor and analyse asset metadata. It keeps create, update and delete history for 35 days. It is not designed for real-time querying: for the live state of one resource, call that service's own API. Some changes take time to appear; the supported asset types page notes, for example, that disabling or enabling a service account can take up to 48 hours to be reflected.

What you get back depends on the content type you request. With no content type, responses carry only basic information: asset name, last update time and ancestors.

Content typeWhat it returnsSecurity use
RESOURCEFull resource metadata (also used for organisation policy v2 as orgpolicy.googleapis.com/Policy)Configuration review, public IPs, storage settings, constraint coverage
IAM_POLICYIAM allow policy bindings attached to each resourcePrivilege review, external and public principals
ORG_POLICYLegacy organisation policy (v1)Older constraint checks
ACCESS_POLICYAccess Context Manager policies (exportable only at organisation level)VPC Service Controls perimeter review
OS_INVENTORYRuntime OS inventory from VM ManagerPackage and patch visibility on Compute Engine
RELATIONSHIPLinks between assets, such as instance to instance group (Security Command Center Premium or Enterprise)Blast radius and dependency mapping

Permissions needed at organisation scope

Google's roles page lists two predefined roles, granted on an organisation, folder or project: Cloud Asset Viewer (roles/cloudasset.viewer) to read metadata, and Cloud Asset Owner (roles/cloudasset.owner) which adds feed management. Every call also needs serviceusage.services.use, for example through roles/serviceusage.serviceUsageConsumer, and the Cloud Asset Inventory API must be enabled in the project you call from. To search the whole organisation, grant the role on the organisation node.

TaskPermission
Search resourcescloudasset.assets.searchAllResources
Search IAM allow policiescloudasset.assets.searchAllIamPolicies
ExportOne per content type, e.g. cloudasset.assets.exportResource, cloudasset.assets.exportIamPolicy
Create or update feedscloudasset.feeds.create or .update, plus the export permission for the content type
Policy Analyzercloudasset.assets.analyzeIamPolicy, searchAllIamPolicies and searchAllResources; iam.roles.get to expand custom roles

Because an organisation-wide viewer can map every privileged binding in the estate, grant it to a named security group and to dedicated inventory service accounts, not to broad engineering groups. See the Google Cloud IAM and Service Accounts Guide.

Search resources and IAM policies

There are two search methods, both available through REST (POST https://cloudasset.googleapis.com/v1/SCOPE:searchAllResources and :searchAllIamPolicies) and gcloud. Scope can be projects/PROJECT_ID, folders/FOLDER_ID or organizations/ORGANIZATION_ID. Results page at up to 500 per request. Use --asset-types (RE2 regular expressions allowed) to narrow results, --read-mask to choose fields and --order-by to sort.

Example command shape:

gcloud asset search-all-iam-policies --scope=organizations/ORGANIZATION_ID --query='memberTypes:(allUsers OR allAuthenticatedUsers)'

Query examples for security reviews

QuestionMethodQuery and options
Which resources are open to the public or to any Google account?searchAllIamPoliciesmemberTypes:(allUsers OR allAuthenticatedUsers)
Who holds Owner directly?searchAllIamPoliciesroles:roles/owner
Who can change IAM policy at any level?searchAllIamPoliciespolicy.role.permissions:(resourcemanager.organizations.setIamPolicy OR resourcemanager.folders.setIamPolicy OR resourcemanager.projects.setIamPolicy)
Which bindings mention an external domain?searchAllIamPoliciespolicy:"domain:example.com" (repeat per partner domain)
Where is a given service account granted access?searchAllIamPoliciespolicy:"serviceAccount:NAME@PROJECT_ID.iam.gserviceaccount.com"
Which bindings grant roles to service accounts at all?searchAllIamPoliciesmemberTypes:serviceAccount
List every service accountsearchAllResources--asset-types=iam.googleapis.com/ServiceAccount
List user-managed service account keyssearchAllResources--asset-types=iam.googleapis.com/ServiceAccountKey
List API keyssearchAllResources--asset-types=apikeys.googleapis.com/Key
Which custom roles include a sensitive permission?searchAllResources--asset-types=iam.googleapis.com/Role with includedPermissions:iam.serviceAccountKeys.create
Find deny policiessearchAllResourcesname:denypolicies with --asset-types=iam.googleapis.com/PolicyV2
Find VMs with external IPssearchAllResources--asset-types=compute.googleapis.com/Instance and externalIPs:*
Find unlabelled or out-of-region resourcessearchAllResourcesNOT labels.env:*; NOT location:europe-*

Query syntax points that catch people out: = is an exact match and : a partial match; the policy field accepts only :; and queries on roles and memberTypes return direct grants only, not access inherited from a folder or the organisation. Not every resource type is searchable, so check the supported asset types page before relying on a query for coverage. Search is synchronous and large inventories can consume quota quickly; Google recommends the asynchronous methods (export, long-running analysis) for those cases.

Export and feeds

Export to BigQuery for history and joins

Search answers a question now; export builds a dataset you can join and trend. gcloud asset export --organization=ORGANIZATION_ID --content-type=iam-policy --bigquery-table=projects/P/datasets/D/tables/T --output-bigquery-force writes a snapshot as a long-running operation (check it with gcloud asset operations describe). Useful options from the documentation:

  • Snapshot time: --snapshot-time may be up to 35 days in the past, which lets you reconstruct what a policy looked like before an incident.
  • Per asset type: --per-asset-type writes one table per type, which keeps schemas typed and queries simpler.
  • Appending: appending needs a partitioned table; otherwise the destination must be empty or overwritten. Clustered tables are not supported, and a second export to the same destination within 15 minutes of a running one is rejected.
  • Cloud Storage: export to a bucket instead when another tool ingests files.

A daily scheduled export of RESOURCE and IAM_POLICY into a dedicated, access-restricted dataset is the usual foundation for posture dashboards and access reviews. Protect that dataset: it is a map of every privileged identity in the organisation.

Feeds to Pub/Sub for change detection

A feed watches named assets or asset types and publishes each change to a Pub/Sub topic you have already created. The Cloud Asset Inventory service agent must be allowed to publish to that topic. Key facts from the documentation:

  • Command: gcloud asset feeds create FEED_ID --organization=ORGANIZATION_ID --pubsub-topic=projects/P/topics/T --asset-types=... --content-type=iam-policy, optionally with --condition-expression.
  • Message: each message is a TemporalAsset with the current asset, the priorAsset, priorAssetState and a time window, so a consumer can diff old and new bindings. The first message on a new topic is a welcome string.
  • Conditions: written in CEL against temporal_asset. For example, new assets only: temporal_asset.deleted == false && temporal_asset.prior_asset_state == google.cloud.asset.v1.TemporalAsset.PriorAssetState.DOES_NOT_EXIST. If a condition fails to evaluate, no notification is sent and the error is logged, so test conditions and watch those logs.
  • Limits: up to 200 feeds directly under one parent; creating or changing a feed can take up to 10 minutes to apply; a feed is deleted if its hosting project is permanently deleted, so host feeds in a long-lived security project.

Treat the topic and its subscription as security infrastructure. See the Google Cloud Pub/Sub Security guide for topic permissions and dead-letter handling.

Analysing access (Policy Analyzer)

Search tells you what is written in each policy. Policy Analyzer for allow policies answers the question security teams usually mean: who can actually reach a resource. It evaluates allow policies across a chosen organisation, folder or project and its descendants, and supports four query patterns: who can access a resource, which principals have given roles or permissions, what access a principal has on a resource, and which resources a principal can access.

  • Expansion: groups expand to members (up to 1,000 per group, nested groups if you have the group permissions), roles expand to permissions, and resources expand to descendants.
  • Scope limits: it does not evaluate deny policies, Principal Access Boundary policies, GKE RBAC or Cloud Storage ACLs, so a result is an upper bound on access from allow policies, not a final answer. Service account keys are not available in the analysis APIs.
  • Quota: each organisation gets 20 analysis queries per day at no charge; more requires Security Command Center Premium or Enterprise activated at organisation level. Plan recurring analyses around that limit.
  • Long-running export: analyzeIamPolicyLongrunning writes results to BigQuery or Cloud Storage, which suits quarterly access reviews.
NeedUseWhy
Quick answer on direct grantssearchAllIamPoliciesFast, no daily analysis quota
Effective access including inheritance and groupsPolicy AnalyzerResolves hierarchy, group membership and role contents
Trend over time, joins with HR or CMDB dataBigQuery exportPoint-in-time snapshots and SQL
Alert on changeFeed to Pub/SubEvent per change with prior state

Security use cases

NHI and service account discovery

Machine identities usually outnumber people in a Google Cloud organisation, and many have no clear owner. A practical discovery run:

  1. List every iam.googleapis.com/ServiceAccount at organisation scope, recording project, email and description.
  2. List iam.googleapis.com/ServiceAccountKey assets to find user-managed keys, then compare with the key replacement plan in How to inventory Google Cloud service account keys and replace them with federation.
  3. For each service account, search bindings with policy:"serviceAccount:EMAIL" to see where it holds roles, including in other projects.
  4. Flag service accounts holding basic roles (Owner, Editor) or setIamPolicy permissions, and those granted roles/iam.serviceAccountTokenCreator or roles/iam.serviceAccountUser to others, since those allow impersonation.
  5. List apikeys.googleapis.com/Key assets and check each has API and application restrictions.
  6. Join the results with usage data from the IAM recommender or audit logs to find accounts that hold roles but are not used.

See the Google Cloud Service Account Keys Security Guide for what to do with the keys you find.

Detections worth building on feeds

ChangeFeed scopeATT&CK
New binding to allUsers or allAuthenticatedUsersIAM_POLICY, all typesT1530 Data from Cloud Storage
New Owner or setIamPolicy grant at organisation or folderIAM_POLICY on organisation and foldersT1098 Account Manipulation
New user-managed service account keyRESOURCE, iam.googleapis.com/ServiceAccountKeyT1098.001 Additional Cloud Credentials
New service account in a production projectRESOURCE, iam.googleapis.com/ServiceAccountT1078.004 Cloud Accounts
Organisation policy constraint removed or changedRESOURCE, orgpolicy.googleapis.com/PolicyPosture drift

Pair feeds with Cloud Audit Logs, which say who made the change; the feed says what the resource now looks like. See the Google Cloud Audit Logs and Log Sinks Guide. Defenders should also remember that the same APIs help an intruder: organisation-wide asset search with a stolen viewer credential is a fast form of T1580 Cloud Infrastructure Discovery, so alert on unusual callers of SearchAllIamPolicies in Data Access logs where those are enabled.

Measurement

  • Public bindings: count of resources with allUsers or allAuthenticatedUsers bindings, target zero outside an approved list.
  • Direct Owner grants: number of principals with basic roles at project level and above, trending down.
  • Key debt: user-managed service account keys, and their age distribution.
  • Ownership: share of service accounts with a recorded owner label or description.
  • Detection latency: time from a risky change to an alert from the feed pipeline, tested monthly with a planted change.

Framework mapping

FrameworkReferenceHow Cloud Asset Inventory supports it
NIST CSF 2.0ID.AM-02, PR.AA-05, DE.CM-09Inventory of services, access review, monitoring of changes
NIST SP 800-53 Rev. 5CM-8, AC-2, AC-6, AU-6Component inventory, account management, least privilege evidence, review of records
CIS Controls v8.1Control 1, Control 5 (5.1)Enterprise asset inventory; inventory of accounts including service accounts
ISO/IEC 27001:2022Annex A 5.9, 5.18Inventory of information and other associated assets; access rights

Common failure patterns

  • Project-by-project scripts: loops over the projects a user happens to see miss projects outside that view. Search and export at organisation scope instead.
  • Reading direct grants as the whole truth: a roles:roles/owner search misses Owner inherited from a folder or held through a group. Use Policy Analyzer for effective access before declaring a principal clean.
  • Over-broad viewer grants: giving Cloud Asset Viewer at organisation level to large groups or to CI service accounts hands an intruder a full privilege map.
  • Feeds in short-lived projects: a feed disappears with its project, and a failed condition silently sends nothing. Host feeds centrally and alert when expected messages stop.
  • Treating it as real-time: metadata can lag (up to 48 hours for service account enable or disable), so confirm with the service API before acting on a single result during an incident.
  • Unprotected export datasets: a BigQuery dataset of every IAM policy readable by analysts and dashboards widens exposure. Restrict it like the policies themselves.

Practitioner checklist

  • Enable the Cloud Asset Inventory API in a dedicated security project and grant Cloud Asset Viewer at organisation level only to a named security group and inventory service accounts.
  • Run the public-binding, Owner and setIamPolicy searches at organisation scope and record a baseline.
  • Build a full inventory of service accounts, user-managed keys and API keys, and assign an owner to each.
  • Schedule a daily export of RESOURCE and IAM_POLICY to a restricted BigQuery dataset.
  • Create organisation-level feeds for public bindings, privileged grants, new service account keys and organisation policy changes, and route them to the SOC.
  • Test each feed condition with a planted change and alert when a feed goes quiet.
  • Use Policy Analyzer, within its daily quota, for effective-access questions on crown-jewel resources.
  • Track the five metrics above monthly and report the trend.

Standards and references

Related NHI Mgmt Group resources: Google Cloud Security Guide · Google Cloud IAM and Service Accounts Guide · Google Cloud Organization Policy Guide · Security Command Center Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.