A DevOps automation principal needs to grant a service account the minimum necessary IAM roles and execute the appropriate gcloud commands to create a new workload project inside a corporate folder and link it to an existing Cloud Billing Account. Arrange the steps in the correct operational sequence from first to last to complete this task under the principle of least privilege.
- 1Grant the service account the Project Creator (`roles/resourcemanager.projectCreator`) role on the target Folder.
- 2Grant the service account the Billing Account User (`roles/billing.user`) role on the target Cloud Billing Account.
- 3Execute `gcloud projects create PROJECT_ID --folder=FOLDER_ID` to provision the new project inside the designated folder.
- 4Execute `gcloud billing projects link PROJECT_ID --billing-account=BILLING_ACCOUNT_ID` to attach billing to the newly created project.
Answer
The correct operational sequence begins with granting `roles/resourcemanager.projectCreator` on the target folder, followed by granting `roles/billing.user` on the Cloud Billing Account, creating the project using `gcloud projects create`, and finally linking the billing account using `gcloud billing projects link`.
Permissions must be configured prior to executing CLI commands. First, folder-level project creation rights (`roles/resourcemanager.projectCreator`) and billing account consumption rights (`roles/billing.user`) are established. Second, the project is created under the folder via `gcloud projects create`. Finally, billing is attached via `gcloud billing projects link`.
Step-by-Step Solution
Key Concept
Configuring least-privilege IAM roles (`roles/resourcemanager.projectCreator` and `roles/billing.user`) and executing the gcloud tool sequence for project creation and billing link association.