This page describes how to grant, change, and revoke access to projects, folders, and organizations. To learn how to manage access to other resources, see the following guides:
In Identity and Access Management (IAM), access is managed through IAM policies. An IAM policy is attached to a Google Cloud resource. Each policy contains a collection of role bindings that associate one or more members, such as users or service accounts, with an IAM role. These role bindings grant the specified roles to the members, both on the resource that the policy is attached to and on all of that resource's descendants. For more information about IAM policies, see Understanding policies.
You can manage access to projects, folders, and organizations with the
Google Cloud Console, the gcloud command-line tool, the REST API, or the Resource Manager
client libraries.
Before you begin
Enable the Cloud Resource Manager API.Required permissions
To manage access to a project, folder, or organization, you need a role that includes the following
permissions,
where RESOURCE_TYPE is the resource type that the member will manage access to (projects, folders, or organizations):
resourcemanager.RESOURCE_TYPE.getresourcemanager.RESOURCE_TYPE.getIamPolicyresourcemanager.RESOURCE_TYPE.setIamPolicy
To gain these permissions while following the principle of least privilege, ask your administrator to grant you one of the following roles:
- To manage access to projects: Project IAM Admin (
roles/resourcemanager.projectIamAdmin) - To manage access to projects and folders: Folder Admin (
roles/resourcemanager.folderAdmin) - To manage access to projects, folders, and organizations: Organization Admin (
roles/resourcemanager.organizationAdmin) - To manage access to almost all Google Cloud resources: Security Admin (
roles/iam.securityAdmin)
Alternatively, your administrator can grant you a different role with the required permissions, such as a custom role or a more permissive predefined role.
View current access
You can view who has access to your project, folder, or organization using
the Cloud Console, the gcloud tool, the REST API, or the
Resource Manager client libraries.
Console
In the Cloud Console, go to the IAM page.
Select a project, folder, or organization.
The Cloud Console lists all the members who have been granted roles on your project, folder, or organization. This list includes members who have inherited roles on the resource from parent resources. For more information about policy inheritance, see Policy inheritance and the resource hierarchy.
Optional: To view role grants for Google-managed service accounts, select the Include Google-provided role grants checkbox.

gcloud
To see who has access to your project, folder, or organization, get the IAM policy for the resource. To learn how to interpret IAM policies, see Understanding policies.
To get the IAM policy for the resource, run the get-iam-policy
command for the resource:
gcloud RESOURCE_TYPE get-iam-policy RESOURCE_ID --format=FORMAT > PATH
Provide the following values:
RESOURCE_TYPE: The type of the resource that you want to view access to. Use one of these values:projects,resource-manager folders, ororganizations.RESOURCE_ID: Your Google Cloud project, folder, or organization ID. Project IDs are alphanumeric, likemy-project. Folder and organization IDs are numeric, like123456789012.FORMAT: The desired format for the policy. Usejsonoryaml.PATH: The path to a new output file for the policy.
For example, the following command gets the policy for the project my-project
and saves it to your home directory in JSON format:
gcloud projects get-iam-policy my-project --format=json > ~/policy.json
REST
To see who has access to your project, folder, or organization, get the IAM policy for the resource. To learn how to interpret IAM policies, see Understanding policies.
The Resource Manager API's
getIamPolicy
method gets a project's, folder's, or organization's IAM policy.
Before using any of the request data, make the following replacements:
API_VERSION: The API version to use. For projects and organizations, usev1. For folders, usev2.RESOURCE_TYPE: The resource type whose policy you want to manage. Use the valueprojects,folders, ororganizations.RESOURCE_ID: Your Google Cloud project, organization, or folder ID. Project IDs are alphanumeric strings, likemy-project. Folder and organization IDs are numeric, like123456789012.POLICY_VERSION: The policy version to be returned. Requests should specify the most recent policy version, which is policy version 3. See Specifying a policy version when getting a policy for details.
HTTP method and URL:
POST https://cloudresourcemanager.googleapis.com/API_VERSION/RESOURCE_TYPE/RESOURCE_ID:getIamPolicy
Request JSON body:
{
"options": {
"requestedPolicyVersion": POLICY_VERSION
}
}
To send your request, expand one of these options:
The response contains the resource's IAM policy. For example:
{
"version": 1,
"etag": "BwWKmjvelug=",
"bindings": [
{
"role": "roles/owner",
"members": [
"user:owner@example.com"
]
}
]
}
C#
Java
Python
Grant or revoke a single role
You can use the Cloud Console and the gcloud tool to quickly
grant or revoke a single role for a single member, without editing the
resource's IAM policy directly. Common types of members
include Google accounts, service accounts, Google groups, and domains. For a
list of all member types, see Concepts related to
identity.
Grant a single role
To grant a single role to a member, do the following:
Console
In the Cloud Console, go to the IAM page.
Select a project, folder, or organization.
Select a member to grant a role to:
To grant a role to an existing member, find the row containing the member's email address, click Edit member in that row, and click Add another role.
If you want to grant a role to a Google-managed service account, you must select the Include Google-provided role grants checkbox to see its email address.
To grant a role to a new member, click Add, then enter the member's email address.
Select a role to grant from the drop-down list. For best security practices, choose a role that includes only the permissions that your member needs.
Optional: Add a condition to the role.
Click Save. The member is granted the role on the resource.
To grant a role to a member for more than one project, folder, or organization, do the following:
In the Cloud Console, go to the Manage resources page.
Select all the resources for which you want to grant permissions.
If the info panel is not visible, click Show info panel. Then, click Permissions.
Select a member to grant a role to:
To grant a role to an existing member, find a row with the member's email address, click Edit member in that row, and click Add another role.
To grant a role to a new member, click Add member, then enter the member's email address.
Select a role to grant from the drop-down list.
Optional: Add a condition to the role.
Click Save. The member is granted the selected role on each of the selected resources.
gcloud
To quickly grant a role to a member, run the add-iam-policy-binding
command:
gcloud RESOURCE_TYPE add-iam-policy-binding RESOURCE_ID \
--member=MEMBER --role=ROLE_ID \
--condition=CONDITION
Provide the following values:
RESOURCE_TYPE: The resource type that you want to manage access to. Useprojects,resource-manager folders, ororganizations.RESOURCE_ID: Your Google Cloud project, folder, or organization ID. Project IDs are alphanumeric, likemy-project. Folder and organization IDs are numeric, like123456789012.MEMBER: An identifier for the member, which usually has the following form:MEMBER_TYPE:ID. For example,user:my-user@example.com. For a full list of the values thatMEMBERcan have, see the Policy Binding reference.For the member type
user, the domain name in the identifier must be a Google Workspace domain or a Cloud Identity domain. To learn how to set up a Cloud Identity domain, see the overview of Cloud Identity.ROLE_ID: The name of the role that you want to grant. For example,roles/resourcemanager.projectCreator. For a list of roles, see Understanding roles.CONDITION: Optional. The condition to add to the role binding. For more information about conditions, see the conditions overview.
For example, to grant the Project Creator role to the user
my-user@example.com for the project my-project:
gcloud projects add-iam-policy-binding my-project \
--member=user:my-user@example.com --role=roles/resourcemanager.projectCreator
Revoke a single role
To revoke a single role from a member, do the following:
Console
In the Cloud Console, go to the IAM page.
Select a project, folder, or organization.
Find the row with the email address of the member whose access you want to revoke. Then, click Edit member in that row.
Click the Delete button for each role you want to revoke, and then click Save.
gcloud
To quickly revoke a role from a user, run the remove-iam-policy-binding
command:
gcloud RESOURCE_TYPE remove-iam-policy-binding RESOURCE_ID \
--member=MEMBER --role=ROLE_ID
Provide the following values:
RESOURCE_TYPE: The resource type that you want to manage access to. Useprojects,resource-manager folders, ororganizations.RESOURCE_ID: Your Google Cloud project, folder, or organization ID. Project IDs are alphanumeric, likemy-project. Folder and organization IDs are numeric, like123456789012.MEMBER: An identifier for the member, which usually has the following form:MEMBER_TYPE:ID. For example,user:my-user@example.com. For a full list of the values thatMEMBERcan have, see the Policy Binding reference.For the member type
user, the domain name in the identifier must be a Google Workspace domain or a Cloud Identity domain. To learn how to set up a Cloud Identity domain, see the overview of Cloud Identity.ROLE_ID: The name of the role that you want to revoke. For example,roles/resourcemanager.projectCreator. For a list of roles, see Understanding roles.
For example, to revoke the Project Creator role from the user
my-user@example.com for the project my-project:
gcloud projects remove-iam-policy-binding my-project \
--member=user:my-user@example.com --role=roles/resourcemanager.projectCreator
Grant or revoke multiple roles
To make large-scale access changes that involve granting and revoking multiple roles, use the read-modify-write pattern to update the resource's IAM policy:
- Reading the current policy by calling
getIamPolicy(). - Editing the returned policy, either by using a text editor or programmatically, to add or remove any members or role bindings.
- Writing the updated policy by calling
setIamPolicy().
You can use the gcloud tool, the REST API, or the Resource Manager
client libraries to update the policy.
Get the current policy
gcloud
To get the IAM policy for the resource, run the get-iam-policy
command for the resource:
gcloud RESOURCE_TYPE get-iam-policy RESOURCE_ID --format=FORMAT > PATH
Provide the following values:
RESOURCE_TYPE: The type of the resource that you want to get the policy for. Use one of the following values:projects,resource-manager folders, ororganizations.RESOURCE_ID: Your Google Cloud project, folder, or organization ID. Project IDs are alphanumeric, likemy-project. Folder and organization IDs are numeric, like123456789012.FORMAT: The desired format for the policy. Usejsonoryaml.PATH: The path to a new output file for the policy.
For example, the following command gets the policy for the project my-project
and saves it to your home directory in JSON format:
gcloud projects get-iam-policy my-project --format json > ~/policy.json
REST
The Resource Manager API's
getIamPolicy
method gets a project's, folder's, or organization's IAM policy.
Before using any of the request data, make the following replacements:
API_VERSION: The API version to use. For projects and organizations, usev1. For folders, usev2.RESOURCE_TYPE: The resource type whose policy you want to manage. Use the valueprojects,folders, ororganizations.RESOURCE_ID: Your Google Cloud project, organization, or folder ID. Project IDs are alphanumeric strings, likemy-project. Folder and organization IDs are numeric, like123456789012.POLICY_VERSION: The policy version to be returned. Requests should specify the most recent policy version, which is policy version 3. See Specifying a policy version when getting a policy for details.
HTTP method and URL:
POST https://cloudresourcemanager.googleapis.com/API_VERSION/RESOURCE_TYPE/RESOURCE_ID:getIamPolicy
Request JSON body:
{
"options": {
"requestedPolicyVersion": POLICY_VERSION
}
}
To send your request, expand one of these options:
The response contains the resource's IAM policy. For example:
{
"version": 1,
"etag": "BwWKmjvelug=",
"bindings": [
{
"role": "roles/owner",
"members": [
"user:owner@example.com"
]
}
]
}
Save the response in a file of the appropriate type (json or yaml).
C#
Java
Python
Modify the policy
Programmatically or using a text editor, modify the local copy of your resource's policy to reflect the roles you want to grant or revoke to given users.
To ensure that you do not overwrite other policy changes, do not edit or remove
the policy's etag field. The etag field identifies the current policy state.
When you set the updated policy, IAM
compares the etag value in the request with the existing etag, and only
writes the policy if the values match.
Grant a role
To grant roles to your members, modify the role bindings in the policy. To learn what roles you can grant, see Understanding roles, or view grantable roles for the resource.
To grant a role that is already included in the policy, add the member to an existing role binding:
gcloud
Edit the returned policy by adding the member to an existing role binding. Note that this policy change will not take effect until you set the updated policy.
For example, imagine the returned policy contains the following role binding,
which grants the Security Reviewer role (roles/iam.securityReviewer) to
kai@example.com:
{
"role": "roles/iam.securityReviewer",
"members": [
"user:kai@example.com"
]
}
To grant that same role to raha@example.com, add raha@example.com to the
existing role binding:
{
"role": "roles/iam.securityReviewer",
"members": [
"user:kai@example.com",
"user:raha@example.com"
]
}
REST
Edit the returned policy by adding the member to an existing role binding. Note that this policy change will not take effect until you set the updated policy.
For example, imagine the returned policy contains the following role binding,
which grants the Security Reviewer role (roles/iam.securityReviewer) to
kai@example.com:
{
"role": "roles/iam.securityReviewer",
"members": [
"user:kai@example.com"
]
}
To grant that same role to raha@example.com, add raha@example.com to the
existing role binding:
{
"role": "roles/iam.securityReviewer",
"members": [
"user:kai@example.com",
"user:raha@example.com"
]
}
C#
To learn how to install and use the client library for Resource Manager, see Resource Manager client libraries.
Java
To learn how to install and use the client library for Resource Manager, see Resource Manager client libraries.
Python
To learn how to install and use the client library for Resource Manager, see Resource Manager client libraries.
To grant a role that is not yet included in the policy, add a new role binding:
gcloud
Edit the returned policy by adding a new role binding that grants the role to the member. This policy change will not take effect until you set the updated policy.
For example, to grant the Compute Storage Admin role
(roles/compute.storageAdmin) to raha@example.com, add the following role
binding to the bindings array for the policy:
{
"role": "roles/compute.storageAdmin",
"members": [
"user:raha@example.com"
]
}
REST
Edit the returned policy by adding a new role binding that grants the role to the member. This policy change will not take effect until you set the updated policy.
For example, to grant the Compute Storage Admin role
(roles/compute.storageAdmin) to raha@example.com, add the following role
binding to the bindings array for the policy:
{
"role": "roles/compute.storageAdmin",
"members": [
"user:raha@example.com"
]
}
C#
To learn how to install and use the client library for Resource Manager, see Resource Manager client libraries.
Java
To learn how to install and use the client library for Resource Manager, see Resource Manager client libraries.
Python
To learn how to install and use the client library for Resource Manager, see Resource Manager client libraries.
You can only grant roles related to activated API services. If a service, such as Compute Engine, is not active, you cannot grant roles exclusively related to Compute Engine. For more information, see Enable and disable APIs.
There are some unique constraints when granting permissions on projects,
especially when granting the Owner (roles/owner) role. See the
projects.setIamPolicy()reference documentation
for more information.
Revoke a role
To revoke a role, remove the member from the role binding. If the member is the only member in the role binding, remove the entire role binding.
gcloud
Revoke a role by editing the JSON or YAML policy returned by the
get-iam-policy command. This policy change will not
take effect until you set the updated policy.
To revoke a role from a member, delete the desired members or bindings
from the bindings array for the policy.
REST
Revoke a role by editing the JSON or YAML policy returned by the
get-iam-policy command. This policy change will not
take effect until you set the updated policy.
To revoke a role from a member, delete the desired members or bindings
from the bindings array for the policy.
C#
To learn how to install and use the client library for Resource Manager, see Resource Manager client libraries.
Java
To learn how to install and use the client library for Resource Manager, see Resource Manager client libraries.
Python
To learn how to install and use the client library for Resource Manager, see Resource Manager client libraries.
Set the policy
After you modify the policy to grant and revoke the desired roles, call
setIamPolicy() to make the updates.
gcloud
To set the IAM policy for the resource, run the set-iam-policy
command for the resource:
gcloud RESOURCE_TYPE set-iam-policy RESOURCE_ID PATH
Provide the following values:
RESOURCE_TYPE: The type of the resource that you want to set the policy for. Use one of the following values:projects,resource-manager folders, ororganizations.RESOURCE_ID: Your Google Cloud project, folder, or organization ID. Project IDs are alphanumeric, likemy-project. Folder and organization IDs are numeric, like123456789012.PATH: The path to a file that contains the new policy.
The response contains the updated policy.
For example, the following command sets the policy stored in policy.json as
the policy for the project my-project:
gcloud projects set-iam-policy my-project ~/policy.json
REST
The Resource Manager API's
setIamPolicy
method sets the policy in the request as the new IAM policy for the project, folder, or organization.
Before using any of the request data, make the following replacements:
API_VERSION: The API version to use. For projects and organizations, usev1. For folders, usev2.RESOURCE_TYPE: The resource type whose policy you want to manage. Use the valueprojects,folders, ororganizations.RESOURCE_ID: Your Google Cloud project, organization, or folder ID. Project IDs are alphanumeric strings, likemy-project. Folder and organization IDs are numeric, like123456789012.-
POLICY: A JSON representation of the policy that you want to set. For more information about the format of a policy, see the Policy reference.For example, to set the policy shown in the previous step, replace
POLICYwith the following:{ "version": 1, "etag": "BwUqLaVeua8=", "bindings": [ { "role": "roles/iam.serviceAccountUser", "members": [ "user:robin@example.com" ] }, { "role": "roles/owner", "members": [ "user:owner@example.com" ] } ] }
HTTP method and URL:
POST https://iam.googleapis.com/API_VERSION/RESOURCE_TYPE/RESOURCE_ID:setIamPolicy
Request JSON body:
{
"policy": POLICY
}
To send your request, expand one of these options:
The response contains the updated policy.
C#
Java
Python
What's next
- Learn how to manage access to service accounts.
- Learn the general steps for managing access to other resources.
- Read about the available IAM roles.
- Use the Policy Troubleshooter to understand why a user does or doesn't have access to a resource or have permission to call an API.
- Discover how to view the roles that you can grant on a particular resource.
- Learn how to make a member's access conditional with conditional role bindings.
- Explore ways to secure your applications with Identity-Aware Proxy.
Try it for yourself
If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
Get started for free