Google Cloud JSM Assets
Google Cloud to JSM Assets Integration Guide
This guide explains how to use OnLink to import Google Cloud resources into JSM Assets, so anyone raising a JSM request can pick the affected project, VM or service account. It covers Google Cloud authentication, the API request, sample data, pagination, field mapping, validation, and import execution.
Overview
OnLink reads Google Cloud resources from the Cloud Asset Inventory API https://docs.cloud.google.com/asset-inventory/docs/reference/rest . One call returns every resource of a given type across the whole Google Cloud organization, so you don't need a separate request per project or zone.
Create one OnLink Assets Data Source per object type. All of them use the same service account and the same endpoint; only the assetTypes value changes. The examples in this guide use Service accounts and VM instances.
The integration uses OnLink mapping statements such as key: and map:, for values nested inside the Google Cloud response.
Google Cloud hierarchy and object types
Google Cloud organizes resources as Organization → Folders → Projects → resources. Build the Assets schema the same way and link each object to its parent with a reference attribute.
Resource hierarchy diagram
The left side is the Google Cloud resource hierarchy, and the right side is the Assets object type each resource becomes. Users come from the Google Workspace or Cloud Identity account linked to the organization, and connect to projects through IAM role bindings.
Object types
Assets object type | Google Cloud resource | Source ( | References |
|---|---|---|---|
GCP Organization | Organization |
| None |
GCP Folder | Folder |
| Parent folder, Organization |
GCP Project | Project |
| Folder, Organization, Billing account |
GCP Service Account | Service account |
| Project |
GCP Host | Sole-tenant node group |
| Project |
GCP VM Instance | Compute Engine instance |
| Project, Service account, Host |
GCP Billing Account | Billing account | Cloud Billing API ( | None (projects reference it) |
GCP User | Google Workspace or Cloud Identity user | Admin SDK Directory API ( | Projects with access |
Import parents before children: Organization, Folders, Billing accounts, Projects, then Service accounts, Hosts and VM instances. These are recommendations, you can define your asset schema and map only the objects you need from Google Cloud.
Prerequisites
Access to OnLink with permission to create or edit Assets Data Sources.
A JSM Assets schema with the object types above. The examples need at least GCP Project, GCP Service Account and GCP VM Instance.
A Google Cloud organization, and an administrator who can create a service account in a project and grant IAM roles at the organization level.
Google Cloud organization ID (see step 1.5).
Step 1: Set up Google Cloud authentication
OnLink authenticates as a Google Cloud service account. It signs a short-lived JWT with the service account's private key and exchanges it for an OAuth access token. Create the service account once and reuse it for every Google Cloud data source.
1.1 Choose a project and enable the APIs
In the Google Cloud console, select an existing admin project or create one, for example
onlink-assets-sync.Go to APIs & Services > Library and enable:
Cloud Asset API (
cloudasset.googleapis.com)Cloud Resource Manager API (
cloudresourcemanager.googleapis.com)Compute Engine API, only if you will import hosts
The APIs must be enabled in the project that owns the service account, even though the data comes from the whole organization.
1.2 Create the service account
Go to IAM & Admin > Service Accounts and click Create service account.
Set the name to
onlink-assets-syncand the description to Read-only inventory sync for JSM Assets.Skip the optional project role grant and click Done. Access is granted at the organization in the next step.
Copy the service account email, for example
onlink-assets-sync@onlink-assets-sync.iam.gserviceaccount.com.
1.3 Grant read access at the organization
In the console resource picker, select your organization, not a project.
Go to IAM & Admin > IAM and click Grant access.
Under New principals, enter the service account email.
Add these roles:
Cloud Asset Viewer (
roles/cloudasset.viewer): reads every resource type through Cloud Asset Inventory.Browser (
roles/browser): looks up the organization, folders and projects.Compute Viewer (
roles/compute.viewer): only if you will import hosts.
Click Save. New grants can take a few minutes to apply.
The same grants with the gcloud CLI:
gcloud organizations add-iam-policy-binding ORG_ID \
--member="serviceAccount:onlink-assets-sync@PROJECT_ID.iam.gserviceaccount.com" \
--role="roles/cloudasset.viewer"
gcloud organizations add-iam-policy-binding ORG_ID \
--member="serviceAccount:onlink-assets-sync@PROJECT_ID.iam.gserviceaccount.com" \
--role="roles/browser"1.4 Create a JSON key
Open the service account and go to the Keys tab.
Click Add key > Create new key, select JSON, and click Create. The browser downloads the key file once.
Keep the file open for step 2. OnLink uses
client_email,private_key_idandprivate_key.
{
"type": "service_account",
"project_id": "onlink-assets-sync",
"private_key_id": "3f9c1e0b7d...",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBg...\n-----END PRIVATE KEY-----\n",
"client_email": "onlink-assets-sync@onlink-assets-sync.iam.gserviceaccount.com",
"client_id": "104857362910283746512",
"token_uri": "https://oauth2.googleapis.com/token"
}If key creation is blocked, the organization enforces the iam.managed.disableServiceAccountKeyCreation constraint. Google enforces it by default on organizations created on or after May 3, 2024. Ask an Organization Policy Administrator to allow key creation for the sync project, then retry.
Store the key only in OnLink, delete the downloaded file afterwards, and rotate the key according to your security policy.
1.5 Find the organization ID
Open the console resource picker and select the All tab; the ID appears next to the organization name. Or run:
gcloud organizations listUse the numeric ID value, for example 34739118321, in the request URL.
1.6 How OnLink gets an access token
OnLink uses Google's JWT bearer flow. It builds the JWT below, signs it with the private key, posts it to the token URL, and receives an access token that it sends as Authorization: Bearer on each request.
Setting | Value |
|---|---|
Token URL |
|
Grant type |
|
Signing algorithm |
|
| The service account email ( |
|
|
|
|
| Issue and expiry time in Unix seconds; |
The token response includes access_token and expires_in (typically 3600 seconds). OnLink requests a new token when the current one expires.
Optional: test the service account before configuring OnLink
gcloud auth activate-service-account --key-file=onlink-key.json
curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://cloudasset.googleapis.com/v1/organizations/ORG_ID/assets?assetTypes=iam.googleapis.com/ServiceAccount&contentType=RESOURCE&pageSize=5"A JSON response with an assets array confirms that the key, roles and API are set up. Switch gcloud back to your own account afterwards with gcloud config set account you@example.com.
Step 2: Configure the OnLink data source
In OnLink, create a new Assets Data Source.
Select the Google Cloud template.
Enter the values from the JSON key file:
Client email:
client_emailPrivate key ID:
private_key_idPrivate key:
private_key, including theBEGINandENDlinesToken URL:
https://oauth2.googleapis.com/token
Set the scope to
https://www.googleapis.com/auth/cloud-platform.Save the data source configuration.
Cloud Asset Inventory only accepts the cloud-platform scope. Read-only access comes from the IAM roles granted in step 1.3, not from the scope.
Step 3: Configure the API request
Configure a GET request to the Cloud Asset Inventory assets.list method. Each data source uses the same URL with its own assetTypes value.
Set Method to
GET.Set URL to the endpoint below, replacing
{ORG_ID}with your organization ID.Set Response data path to
assets.Add the query parameters listed below.
# Service accounts
GET https://cloudasset.googleapis.com/v1/organizations/{ORG_ID}/assets?assetTypes=iam.googleapis.com/ServiceAccount&contentType=RESOURCE&pageSize=1000
# VM instances
GET https://cloudasset.googleapis.com/v1/organizations/{ORG_ID}/assets?assetTypes=compute.googleapis.com/Instance&contentType=RESOURCE&pageSize=1000Query parameter | Value | Purpose |
|---|---|---|
|
| The resource type this data source imports. Use the values from the object type table for other types. |
|
| Returns the full resource metadata in |
|
| Maximum records per page. The default is 100. |
| Optional, RFC 3339 timestamp | Takes the snapshot at an earlier time, up to 35 days back. |
Each record has the same shape for every type: name (the full resource name), assetType, resource.data (the same JSON the service's own API returns), resource.location, ancestors (project, folders, organization) and updateTime.
Step 4: Fetch and review sample data
Save the connection.
Run the data source to fetch sample values from Google Cloud.
Confirm that the response contains the expected
assetsarray.Review the returned JSON fields and compare them with your target JSM Assets attributes.
Sample response: Service account
{
"readTime": "2026-10-21T21:30:12.418Z",
"assets": [
{
"name": "//iam.googleapis.com/projects/acme-web-prod/serviceAccounts/105273648812345678901",
"assetType": "iam.googleapis.com/ServiceAccount",
"resource": {
"version": "v1",
"discoveryName": "ServiceAccount",
"parent": "//cloudresourcemanager.googleapis.com/projects/464036093014",
"location": "global",
"data": {
"name": "projects/acme-web-prod/serviceAccounts/web-runtime@acme-web-prod.iam.gserviceaccount.com",
"projectId": "acme-web-prod",
"uniqueId": "105273648812345678901",
"email": "web-runtime@acme-web-prod.iam.gserviceaccount.com",
"displayName": "Web runtime",
"description": "Runs the storefront VMs",
"oauth2ClientId": "105273648812345678901",
"disabled": false
}
},
"ancestors": [
"projects/464036093014",
"folders/634792535758",
"organizations/34739118321"
],
"updateTime": "2026-10-18T14:02:55.118Z"
}
],
"nextPageToken": "CiAKGjBpNDd2Nmlz..."
}Sample response: VM instance
{
"readTime": "2026-10-21T21:30:12.418Z",
"assets": [
{
"name": "//compute.googleapis.com/projects/acme-web-prod/zones/us-east1-b/instances/web-frontend-01",
"assetType": "compute.googleapis.com/Instance",
"resource": {
"version": "v1",
"discoveryName": "Instance",
"parent": "//cloudresourcemanager.googleapis.com/projects/464036093014",
"location": "us-east1-b",
"data": {
"id": "7415528837051936214",
"name": "web-frontend-01",
"status": "RUNNING",
"zone": "https://www.googleapis.com/compute/v1/projects/acme-web-prod/zones/us-east1-b",
"machineType": "https://www.googleapis.com/compute/v1/projects/acme-web-prod/zones/us-east1-b/machineTypes/e2-standard-4",
"cpuPlatform": "Intel Broadwell",
"creationTimestamp": "2026-04-02T09:14:51.203-07:00",
"networkInterfaces": [
{
"name": "nic0",
"networkIP": "10.20.4.17",
"accessConfigs": [
{ "name": "External NAT", "type": "ONE_TO_ONE_NAT", "natIP": "34.73.112.45" }
]
}
],
"serviceAccounts": [
{
"email": "web-runtime@acme-web-prod.iam.gserviceaccount.com",
"scopes": ["https://www.googleapis.com/auth/cloud-platform"]
}
],
"labels": { "env": "prod", "team": "storefront" }
}
},
"ancestors": [
"projects/464036093014",
"folders/634792535758",
"organizations/34739118321"
],
"updateTime": "2026-10-21T18:42:09.551Z"
}
],
"nextPageToken": "CiAKGjBpNDd2Nmlz..."
}Step 5: Configure pagination
Cloud Asset Inventory uses token-based pagination. Configure it in OnLink before running a full import so every record is retrieved.
Open the pagination settings for the data source.
Set the response field that holds the next page token to
nextPageToken.Set the request query parameter that sends it back to
pageToken. Keep all other query parameters the same on every page.Pagination stops when the response has no
nextPageToken.Test the request with a small
pageSize, such as5, to confirm that OnLink fetches more than one page, then set it back to1000.
Step 6: Configure the Assets import and mapping
After the data source connection is working, create the Assets import by following the JSM Assets Data Synchronization guide.
Use the fetched sample data to map Google Cloud fields to JSM Assets attributes. Each mapping uses the top-level name as the key:, because it is unique across Google Cloud. Values inside resource and ancestors use the jsonpath__ prefix, with .0 for the first array element.
6.1 Service account mapping (GCP Service Account)
OnLink mapping | Assets attribute | Attribute type | Description |
|---|---|---|---|
| Resource Name | Text | Full Cloud Asset name, such as |
| Text (label) | Service account email. Set it as the object label so it shows on requests. | |
| Display Name | Text | Friendly name set by the account owner. |
| Unique ID | Text | Numeric ID. It changes if the account is deleted and recreated with the same email. |
| Project ID | Text | Project ID as text, useful for searching. |
| Description | Textarea | Owner's description of what the account is for. |
| Last Changed | DateTime | When Cloud Asset Inventory last recorded a change. |
6.2 VM instance mapping (GCP VM Instance)
OnLink mapping | Assets attribute | Attribute type | Description |
|---|---|---|---|
| Resource Name | Text | Full Cloud Asset name, such as |
| Name | Text (label) | VM name shown on requests. |
| Instance ID | Text | Numeric instance ID assigned by Compute Engine. |
| Status | Status | Values include |
| Zone | Text | Short zone name, such as |
| Machine Type | Text | Returned as a URL that ends in the machine type, such as |
| CPU Platform | Text | CPU platform reported by Compute Engine. |
| Environment | Text | Example label. Add one line per label key you want in Assets, such as |
| Last Changed | DateTime | When Cloud Asset Inventory last recorded a change. |
The mapping tables list example fields. You can map any field in the response, as long as the corresponding Assets attribute exists.
Mapping guidance
Start with one unique
key:mapping so OnLink can decide whether to create a new Assets object or update an existing one.Run the Project import first, then Service accounts, then VM instances, so every reference finds its target.
A VM deleted and recreated with the same name keeps the same Resource Name, so it updates the existing object. Key on
Instance IDinstead if you want a new object each time.GKE nodes and managed instance group VMs also appear as VM instances and change often. GKE nodes carry a
goog-gke-nodelabel, which you can use to filter or group them.Confirm that every target Assets attribute exists and that spelling and case match the object type configuration.
Step 7: Validate and run the import
Use Get Data to preview the records returned by Google Cloud.
Confirm that the preview contains the expected service accounts or VMs and field values.
Review the object type mapping and verify each target attribute name.
Fix any missing fields, spelling differences, or data type issues.
Run the import after the preview data and mappings are correct.
Troubleshooting checklist
If the token request fails with
invalid_grant, verify the client email and private key (the full value with itsBEGINandENDlines), confirm the key has not been deleted or disabled, and check that the OnLink server clock is correct.If requests fail with
PERMISSION_DENIED, confirm the roles were granted on the organization, not a project, and allow a few minutes for new grants to apply.If the error says the Cloud Asset API has not been used or is disabled, enable it in the project that owns the service account.
If you cannot create a key, see the organization policy note in step 1.4.
If no records are returned, check the organization ID, the
assetTypesspelling,contentType=RESOURCE, and theassetsresponse data path.If only the first 1,000 records arrive, review the
nextPageTokenandpageTokenpagination settings.If Assets objects are duplicated, confirm that
key:name=Resource Nameis configured.If a Project or Runs As reference is empty, confirm the target object was imported first and that its Project Path or Email value matches.
If values do not appear in Assets, verify that each
map:statement points to an existing Assets attribute.