Like many Google Cloud services, Developer Device Platform has a dedicated service agent. This page explains how the DDP service agent works, what it can do, and how you can share resources with it.
Permissions
When DDP is used for a project the first time, the system creates a service
agent-type service account named
service-PROJECT_NUMBER@gcp-sa-devicerun.iam.gserviceaccount.com, where PROJECT_NUMBER is the numeric project
number of the Google Cloud project initiating the Device Run
session.
When you enable the Device Run API (devicerun.googleapis.com), Google Cloud automatically provisions the service agent and assigns it the roles/devicerun.serviceAgent role at the project level.
This service agent is granted permission to the Google Cloud project in which the Developer Device Platform is launched. The service agent uses its own credentials to perform file transfers on your behalf:
- Read and write to Cloud Storage buckets and objects
- Download Cloud Storage input files to the internal system
- Upload files from the internal system to the Cloud Storage output bucket
Both the calling principal (user or service account) and the DDP service agent require Cloud Storage permissions on referenced buckets:
- Caller permissions: The principal calling
CreateSessionmust directly hold permissions on every Cloud Storage bucket referenced in the request. See Caller permissions. - Service agent permissions: If a Cloud Storage bucket is owned by a different Google Cloud project than the one used in DDP, or has bucket-level access restrictions, the DDP service agent might not have access to it. See Sharing access with the service agent.
Caller permissions
Starting January 18, 2027, Device Run requires the calling principal
(user or service account) of CreateSession requests to have direct
Cloud Storage permissions on all referenced buckets, in addition to the DDP
service agent:
- Input buckets (test binaries, APKs, IPAs, and pushed files):
storage.objects.get— for example, Storage Object Viewer (roles/storage.objectViewer). - Output buckets:
storage.objects.createandstorage.objects.delete— for example, Storage Object User (roles/storage.objectUser). - Smart-sharding buckets:
storage.objects.get,storage.objects.create, andstorage.objects.delete— for example, Storage Object User (roles/storage.objectUser).
For example, to grant a calling service account access to specific buckets:
gcloud storage buckets add-iam-policy-binding gs://INPUT_BUCKET_NAME \
--member="serviceAccount:CALLER_SERVICE_ACCOUNT" \
--role="roles/storage.objectViewer"
gcloud storage buckets add-iam-policy-binding gs://OUTPUT_BUCKET_NAME \
--member="serviceAccount:CALLER_SERVICE_ACCOUNT" \
--role="roles/storage.objectUser"
Sharing access with the service agent
See Device Run for how to include files with your tests in the DDP-supported project. If your Cloud Storage bucket resides in a different Google Cloud project from your DDP project and you want Device Run to be able to read these files, you must grant roles/storage.objectViewer to the service agent of the project where the DDP request is initiated as described here.
Grant Storage Object Viewer to the service agent: Ensure the DDP Service Agent
has the Storage Object Viewer (roles/storage.objectViewer) role on the
Cloud Storage bucket containing the files:
gcloud storage buckets add-iam-policy-binding gs://<var>BUCKET_NAME</var> \
--member="serviceAccount:service-<var>PROJECT_NUMBER</var>@gcp-sa-devicerun.iam.gserviceaccount.com" \
--role="roles/storage.objectViewer"
Validation
Now return to your workflow and ensure Device Run has access to the requisite files. If either the calling principal (user or service account) or the DDP service agent does not have access to the specified buckets, the session fails to start.
Supporting documentation
- Types of service accounts: service agents - Learn how service agents operate within Google Cloud
- Service Agents - See every Google Cloud service agent
- Cloud Storage roles and permissions - Find all Cloud Storage-related roles and permissions