Project Iam Binding
Sets the IAM access control policy for the specified Project. CAUTION: This method will replace the existing policy, and cannot be used to append additional IAM settings. NOTE: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles. For additional information about resource
(e.g. my-project-id) structure and identification, see Resource Names. The following constraints apply when using setIamPolicy()
: + Project does not support allUsers
and allAuthenticatedUsers
as members
in a Binding
of a Policy
. + The owner role can be granted to a user
, serviceAccount
, or a group that is part of an organization. For example, group@myownpersonaldomain.com could be added as an owner to a project in the myownpersonaldomain.com organization, but not the examplepetstore.com organization. + Service accounts can be made owners of a project directly without any restrictions. However, to be added as an owner, a user must be invited via Cloud Platform console and must accept the invitation. + A user cannot be granted the owner role using setIamPolicy()
. The user must be granted the owner role using the Cloud Platform Console and must explicitly accept the invitation. + You can only grant ownership of a project to a member by using the GCP Console. Inviting a member will deliver an invitation email that they must accept. An invitation email is not generated if you are granting a role other than owner, or if both the member you are inviting and the project are part of your organization. + If the project is not part of an organization, there must be at least one owner who has accepted the Terms of Service (ToS) agreement in the policy. Calling setIamPolicy()
to remove the last ToS-accepted owner from the policy will fail. This restriction also applies to legacy projects that no longer have owners who have accepted the ToS. Edits to IAM policies will be rejected until the lack of a ToS-accepting owner is rectified. If the project is part of an organization, you can remove all owners, potentially making the organization inaccessible. Authorization requires the Google IAM permission resourcemanager.projects.setIamPolicy
on the project
Properties
Specifies the principals requesting access for a Google Cloud resource. members
can have the following values: * allUsers
: A special identifier that represents anyone who is on the internet; with or without a Google account. * allAuthenticatedUsers
: A special identifier that represents anyone who is authenticated with a Google account or a service account. Does not include identities that come from external identity providers (IdPs) through identity federation. * user:{emailid}
: An email address that represents a specific Google account. For example, alice@example.com
. * serviceAccount:{emailid}
: An email address that represents a Google service account. For example, my-other-app@appspot.gserviceaccount.com
. * serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]
: An identifier for a Kubernetes service account. For example, my-project.svc.id.goog[my-namespace/my-kubernetes-sa]
. * group:{emailid}
: An email address that represents a Google group. For example, admins@example.com
. * domain:{domain}
: The G Suite domain (primary) that represents all the users of that domain. For example, google.com
or example.com
. * deleted:user:{emailid}?uid={uniqueid}
: An email address (plus unique identifier) representing a user that has been recently deleted. For example, alice@example.com?uid=123456789012345678901
. If the user is recovered, this value reverts to user:{emailid}
and the recovered user retains the role in the binding. * deleted:serviceAccount:{emailid}?uid={uniqueid}
: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901
. If the service account is undeleted, this value reverts to serviceAccount:{emailid}
and the undeleted service account retains the role in the binding. * deleted:group:{emailid}?uid={uniqueid}
: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, admins@example.com?uid=123456789012345678901
. If the group is recovered, this value reverts to group:{emailid}
and the recovered group retains the role in the binding.