A security compliance team needs to provide access for an external vulnerability scanner running in an on-premises data center. The scanner must read compute instance details within the project `sec-ops-prod`. Which strategy should the team implement to adhere to Google Cloud security best practices?
- Create a user-managed service account, grant it the Compute Viewer (roles/compute.viewer) predefined role on the project, and configure Workload Identity Federation for keyless authentication.Answer
- BCreate a user-managed service account, grant it the Compute Viewer (roles/compute.viewer) predefined role on the project, and export a service account JSON key file to authenticate the scanner.
- CCreate a user-managed service account, grant it the Editor primitive role on the project, and configure Workload Identity Federation for keyless authentication.
- DGrant the Compute Viewer (roles/compute.viewer) role at the organization level to the service account, and rely on resource hierarchy inheritance to grant access to the project.
Answer
Create a user-managed service account, grant it the Compute Viewer (roles/compute.viewer) predefined role on the project, and configure Workload Identity Federation for keyless authentication.
The recommended security approach for on-premises or external workloads accessing Google Cloud resources is to create a dedicated user-managed service account, grant the minimal predefined IAM role (roles/compute.viewer) restricted to the target project scope, and authenticate using Workload Identity Federation to avoid managing service account JSON keys.
Step-by-Step Solution
Key Concept
Creating service accounts with predefined roles and keyless authentication via Workload Identity Federation