A cloud engineer needs to add a new role binding for a service account in a Google Cloud project by modifying the project's IAM policy via the gcloud CLI using a local policy file. Place the operational steps in the correct sequence to complete this procedure.
- 1Export the current project IAM policy to a local JSON file using `gcloud projects get-iam-policy PROJECT_ID --format=json > policy.json`.
- 2Edit `policy.json` to include the new role and member binding within the `bindings` array.
- 3Apply the modified policy file back to the project using `gcloud projects set-iam-policy PROJECT_ID policy.json`.
- 4Verify the updated permissions by running `gcloud projects get-iam-policy PROJECT_ID` or testing the service account access.
Cevap
The correct sequence is: Export the existing policy to a local file, edit the local file with the new binding, apply the updated policy back to the project, and verify the changes.
Updating an IAM policy via local files follows a get-edit-set pattern. Exporting the policy first prevents dropping existing access controls, editing adds the new access, setting the policy updates GCP, and verification confirms success.
Adım Adım Çözüm
Anahtar Kavram
IAM policy update workflow via declarative gcloud files
Tahmini Süre:1m 30s