- gcloud alpha projects set-iam-policy - set IAM policy for a project
gcloud alpha projects set-iam-policy PROJECT_ID POLICY_FILE [GCLOUD_WIDE_FLAG ...]
(ALPHA) Sets the IAM policy for a project, given a project ID and a file
Project resource - The project to set the IAM policy for. This represents a
Cloud resource. This must be specified.
ID of the project or fully qualified identifier for the project.
Path to a local JSON or YAML formatted file containing a valid policy.
The output of the get-iam-policy command is a valid file, as is any JSON or YAML file conforming to the structure of a Policy (cloud.google.com/iam/reference/rest/v1/Policy
- Project resource - The project to set the IAM policy for. This represents a Cloud resource. This must be specified.
GCLOUD WIDE FLAGS
These flags are available to all commands: --account, --configuration, --flags-file, --flatten, --format, --help, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity. Run $ gcloud help for details.
This command uses the cloudresourcemanager/v1 API. The full documentation for this API can be found at: cloud.google.com/resource-manager
The following command reads an IAM policy defined in a JSON file policy.json and sets it for a project with the ID example-project-id-1:
$ gcloud alpha projects set-iam-policy example-project-id-1 \.RS 2m policy.json
See cloud.google.com/iam/docs/managing-policies for details of the policy file format and contents.
This command is currently in ALPHA and may change without notice. If this command fails with API permission errors despite specifying the right project, you will have to apply for early access and have your projects registered on the API whitelist to use it. To do so, contact Support at cloud.google.com/support These variants are also available:
- $ gcloud projects set-iam-policy $ gcloud beta projects set-iam-policy