Enabling the Cloud Run API (dev console→Cloud Run→Enable) creates five service accounts. I want to understand their purpose. I need to know if it's my responsibility to configure them for least privileged access.
The Default compute service account
has the Editor
role. This is the Cloud Run runtime service account. Its purpose is clear, and I know it's my responsibility to configure it for least privileged access.
The App Engine default service account
has the Editor
role. This matches the description of the Cloud Functions runtime service account. Its purpose is unclear, given the existence of the Cloud Run runtime service account. I don't know if it's my responsibility to configure it for least privileged access.
The Google Container Registry Service Agent
(Editor
role) and Google Cloud Run Service Agent
(Cloud Run Service Agent
role) are both Google-managed service accounts "used to access the APIs of Google Cloud Platform services":
I'd like to see Google-managed service accounts configured for least privileged access. I'd also like to be able to filter the Google-managed service accounts in the IAM section of the GCP console. That said, I know I should ignore them.
The unnamed {project-number}{at}cloudbuild.gserviceaccount.com
service account has the Cloud Build Service Account
role. This service account "can perform builds" but does not appear in the Cloud Run Building Containers docs. It's used for Continuous Deployment—but can't do that without additional user configuration. It's not a Google-managed service account, but it does not appear in the Service Accounts section of the GCP console like the runtime service accounts. Its purpose is unclear. I don't know if it's my responsibility to configure it for least privileged access.
By default, Cloud Run services or jobs run as the default Compute Engine service account. However, Google recommends using a user-managed service account with the most minimal set of permissions.
A service account is a special type of Google account intended to represent a non-human user that needs to authenticate and be authorized to access data in Google APIs. Typically, service accounts are used in scenarios such as: Running workloads on virtual machines (VMs).
Compute Engine uses two types of service accounts: User-managed service accounts. Google-managed service accounts.
Cloud Run Admin API: Deploy and manage user provided container images that scale automatically based on incoming requests. The Cloud Run Admin API v1 follows the Knative Serving API specification, while v2 is aligned with Google Cloud AIP-based API standards, as described in https://google.aip.dev/.
Why are APIs in the cloud so important for developers? Modern developer teams are demanding one essential process: they need to synchronize their system infrastructures with the features of different service providers in the cloud. APIs make this integration possible, where interoperability is key.
However, Google recommends using a user-managed service account with the most minimal set of permissions. Learn how to deploy Cloud Run services with user-managed service accounts in the Cloud Run service identity documentation.
Use the Default Service Account to access the API server. When you create a pod, if you do not specify a service account, it is automatically assigned the default service account in the same namespace.
Note: The process of enabling an API varies depending on the API. Some APIs will prompt you to accept their Terms of Service before you can enable them. Some APIs are in preview mode, meaning that they require special signup and whitelisting before you can use them.
Cloud Run PM:
Editor
because it accesses Cloud Storage, which is oddly broken for "non Editor
access" (I'm still trying to track down the exact issue, but it looks like there's a connection to the legacy Editor
role that requires it).Cloud Run Deployer
(plus to the additional step of allowing the build service account to act as your runtime service account, to prevent [or at least acknowledge] privilege escalation).I too want better filtering of "Google created" and "Google managed" and have been talking with the Cloud IAM team about this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With