Stay organized with collections
Save and categorize content based on your preferences.
By default, only the creator of a Google Cloud project has access
to the project and its resources. To grant other users access, you can grant
Identity and Access Management (IAM) roles on the project, or on a specific
Cloud Build resource.
This page describes the ways you can set access control for your
Cloud Build resources.
Enter the user's or service account's email address.
Select the desired role from the drop-down menu. Cloud Build
roles are under Cloud Build.
Click Save.
gcloud
To grant a role to a principal, run the add-iam-policy-binding command:
gcloud group add-iam-policy-binding resource \
--member=principal --role=role-id
Where:
group: The gcloud CLI group for the resource you
want to update. For example, you can use projects or organizations.
resource: The name of the resource.
principal: An identifier for the principal, which usually
has the following form: principal-type:id. For example, user:my-user@example.com.
For a full list of principal, or member, types, see the
Policy Binding reference.
role-id: The name of the role.
For example, to grant the Cloud Build Viewer role to the user
my-user@example.com for the project my-project:
To run gcloud builds commands, users with only
cloudbuild.builds.viewer or cloudbuild.builds.editor roles also require the
serviceusage.services.use permission. To give this permission to the user, grant
them the serviceusage.serviceUsageConsumer role.
User with roles/editor and roles/owner roles can run
gcloud builds commands without the additional
serviceusage.services.use permission.
Permissions to view build logs
To view build logs, you require additional permissions depending on whether
you're storing your build logs in the default Cloud Storage bucket or in
a user-specified Cloud Storage bucket. For more information on permissions
required to view build logs, see Viewing build logs.
In the permissions table, locate the email ID of the principal and click on the
pencil icon.
Delete the role that you want to revoke.
Click Save.
gcloud
To revoke a role from a user, run the remove-iam-policy-binding command:
gcloud group remove-iam-policy-binding resource \
--member=principal --role=role-id
Where:
group: The gcloud CLI group for the resource you
want to update. For example, you can use projects or organizations.
resource: The name of the resource.
principal: An identifier for the principal, which usually
has the following form: principal-type:id. For example, user:my-user@example.com.
For a full list of principal, or member, types, see the
Policy Binding reference.
role-id: The name of the role.
For example, to revoke the Cloud Build Viewer role from the user
my-user@example.com for the project my-project:
For users that want to define their own roles containing bundles of
permissions that they specify, IAM offers custom roles. For instructions
on creating and using IAM custom roles, see Creating and Managing Custom
Roles.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eBy default, only the project creator has access, and you can grant access to other users by assigning Identity and Access Management (IAM) roles either at the project level or for specific Cloud Build resources.\u003c/p\u003e\n"],["\u003cp\u003eAccess can be granted to users or service accounts through the Google Cloud console's IAM page or by using the \u003ccode\u003egcloud\u003c/code\u003e command-line tool's \u003ccode\u003eadd-iam-policy-binding\u003c/code\u003e command.\u003c/p\u003e\n"],["\u003cp\u003eUsers with \u003ccode\u003ecloudbuild.builds.viewer\u003c/code\u003e or \u003ccode\u003ecloudbuild.builds.editor\u003c/code\u003e roles need the \u003ccode\u003eserviceusage.services.use\u003c/code\u003e permission to run \u003ccode\u003egcloud builds\u003c/code\u003e commands, which can be granted by assigning them the \u003ccode\u003eserviceusage.serviceUsageConsumer\u003c/code\u003e role.\u003c/p\u003e\n"],["\u003cp\u003eRoles can be revoked using the Google Cloud console by editing permissions on the IAM page, or via the \u003ccode\u003egcloud\u003c/code\u003e tool with the \u003ccode\u003eremove-iam-policy-binding\u003c/code\u003e command.\u003c/p\u003e\n"],["\u003cp\u003eIAM custom roles can be created to bundle specific permissions, but must include the \u003ccode\u003eserviceusage.services.use\u003c/code\u003e permission for Cloud Build custom roles.\u003c/p\u003e\n"]]],[],null,["# Configuring access to Cloud Build resources\n\nBy default, only the creator of a Google Cloud project has access\nto the project and its resources. To grant other users access, you can grant\nIdentity and Access Management (IAM) roles on the project, or on a specific\nCloud Build resource.\n\nThis page describes the ways you can set access control for your\nCloud Build resources.\n\nBefore you begin\n----------------\n\n- Understand the [basic concepts of IAM](/iam/docs/overview).\n- Learn about the [Cloud Build roles and permissions](/build/docs/iam-roles-permissions).\n\nGranting roles on the project\n-----------------------------\n\n### Console\n\n1. Open the IAM page in the Google Cloud console:\n\n [Open the IAM page](https://console.cloud.google.com/iam-admin/roles)\n2. Select your project, and click **Continue**.\n\n3. Click **Grant access**.\n\n4. Enter the user's or service account's email address.\n\n5. Select the desired role from the drop-down menu. Cloud Build\n roles are under **Cloud Build**.\n\n6. Click **Save**.\n\n| **Note:** If you do not see the Cloud Build roles in the drop-down menu, you may need to [enable the Cloud Build\n| API](https://console.cloud.google.com/flows/enableapi?apiid=cloudbuild.googleapis.com&_ga=1.128224844.1904271179.1489680703).\n\n### gcloud\n\nTo grant a role to a principal, run the `add-iam-policy-binding` command: \n\n gcloud \u003cvar translate=\"no\"\u003egroup\u003c/var\u003e add-iam-policy-binding \u003cvar translate=\"no\"\u003eresource\u003c/var\u003e \\\n --member=\u003cvar translate=\"no\"\u003eprincipal\u003c/var\u003e --role=\u003cvar translate=\"no\"\u003erole-id\u003c/var\u003e\n\nWhere:\n\n- \u003cvar translate=\"no\"\u003egroup\u003c/var\u003e: The gcloud CLI group for the resource you\n want to update. For example, you can use projects or organizations.\n\n- \u003cvar translate=\"no\"\u003eresource\u003c/var\u003e: The name of the resource.\n\n- \u003cvar translate=\"no\"\u003eprincipal\u003c/var\u003e: An identifier for the principal, which usually\n has the following form: principal-type:id. For example, user:my-user@example.com.\n For a full list of principal, or member, types, see the\n [Policy Binding reference](/iam/docs/reference/rest/v1/Policy#Binding).\n\n- \u003cvar translate=\"no\"\u003erole-id\u003c/var\u003e: The name of the role.\n\nFor example, to grant the Cloud Build Viewer role to the user\n`my-user@example.com` for the project `my-project`: \n\n gcloud projects add-iam-policy-binding my-project \\\n --member=user:my-user@example.com --role=roles/cloudbuild.builds.viewer\n\nGranting permissions to run gcloud commands\n-------------------------------------------\n\nTo run [`gcloud builds`](/sdk/gcloud/reference/builds) commands, users with only\n`cloudbuild.builds.viewer` or `cloudbuild.builds.editor` roles also require the\n`serviceusage.services.use` permission. To give this permission to the user, grant\nthem the `serviceusage.serviceUsageConsumer` role.\n\nUser with roles/editor and roles/owner roles can run\n[`gcloud builds`](/sdk/gcloud/reference/builds) commands without the additional\n`serviceusage.services.use` permission.\n\nPermissions to view build logs\n------------------------------\n\nTo view build logs, you require additional permissions depending on whether\nyou're storing your build logs in the default Cloud Storage bucket or in\na user-specified Cloud Storage bucket. For more information on permissions\nrequired to view build logs, see [Viewing build logs](/build/docs/securing-builds/store-manage-build-logs#viewing_build_logs).\n\nRevoking roles on the project\n-----------------------------\n\n### Console\n\n1. Open the IAM page in the Google Cloud console:\n\n [Open the IAM page](https://console.cloud.google.com/iam-admin/roles)\n2. Select your project, and click **Continue**.\n\n3. In the permissions table, locate the email ID of the principal and click on the\n pencil icon.\n\n4. Delete the role that you want to revoke.\n\n5. Click **Save**.\n\n### gcloud\n\nTo revoke a role from a user, run the `remove-iam-policy-binding` command: \n\n gcloud \u003cvar translate=\"no\"\u003egroup\u003c/var\u003e remove-iam-policy-binding \u003cvar translate=\"no\"\u003eresource\u003c/var\u003e \\\n --member=\u003cvar translate=\"no\"\u003eprincipal\u003c/var\u003e --role=\u003cvar translate=\"no\"\u003erole-id\u003c/var\u003e\n\nWhere:\n\n- \u003cvar translate=\"no\"\u003egroup\u003c/var\u003e: The gcloud CLI group for the resource you\n want to update. For example, you can use projects or organizations.\n\n- \u003cvar translate=\"no\"\u003eresource\u003c/var\u003e: The name of the resource.\n\n- \u003cvar translate=\"no\"\u003eprincipal\u003c/var\u003e: An identifier for the principal, which usually\n has the following form: principal-type:id. For example, user:my-user@example.com.\n For a full list of principal, or member, types, see the\n [Policy Binding reference](/iam/docs/reference/rest/v1/Policy#Binding).\n\n- \u003cvar translate=\"no\"\u003erole-id\u003c/var\u003e: The name of the role.\n\nFor example, to revoke the Cloud Build Viewer role from the user\n`my-user@example.com` for the project `my-project`: \n\n gcloud projects remove-iam-policy-binding my-project \\\n --member=user:my-user@example.com --role=roles/cloudbuild.builds.viewer\n\nViewing roles on the project\n----------------------------\n\n### Console\n\n1. Open the IAM page in the Google Cloud console:\n\n [Open the IAM page](https://console.cloud.google.com/iam-admin/roles)\n2. Select your project, and click **Continue**.\n\n3. Under **View by** , click **Roles**.\n\n4. To view the principals with a particular role, expand the role name.\n\n### gcloud\n\nTo view all users that are granted a particular role in a Google Cloud project,\nrun the following command: \n\n gcloud projects get-iam-policy \u003cvar translate=\"no\"\u003eproject-id\u003c/var\u003e \\\n --flatten=\"bindings[].members\" \\\n --format=\"table(bindings.members)\" \\\n --filter=\"bindings.role:\u003cvar translate=\"no\"\u003erole-id\u003c/var\u003e\"\n\nWhere:\n\n- \u003cvar translate=\"no\"\u003eproject-id\u003c/var\u003e is your project ID.\n\n- \u003cvar translate=\"no\"\u003erole-id\u003c/var\u003e is the name of the role for which you want\n to view the principals.\n\nFor example, to view all principals in a project that are granted the Google Cloud project\nViewer role, run the following command: \n\n gcloud projects get-iam-policy my-project \\\n --flatten=\"bindings[].members\" \\\n --format=\"table(bindings.members)\" \\\n --filter=\"bindings.role:roles/cloudbuild.builds.viewer\"\n\nCreating IAM custom roles\n-------------------------\n\nFor users that want to define their own roles containing bundles of\npermissions that they specify, IAM offers custom roles. For instructions\non creating and using IAM custom roles, see [Creating and Managing Custom\nRoles](/iam/docs/creating-custom-roles).\n| **Note:** You must include the `serviceusage.services.use` permission in each Cloud Build custom role you create.\n\nWhat's next\n-----------\n\n- Learn about [Default Cloud Build service account](/build/docs/cloud-build-service-account).\n- Learn how to [configure access to Cloud Build service account](/build/docs/securing-builds/configure-access-for-cloud-build-service-account).\n- Learn about [the permissions required to view build logs](/build/docs/securing-builds/store-view-build-logs)."]]