Google Cloud Professional Cloud Developer — Question 91

You have written a Cloud Function that accesses other Google Cloud resources. You want to secure the environment using the principle of least privilege. What should you do?

Answer options

Correct answer: D

Explanation

Option D is correct because it ensures that the service account is granted only the permissions necessary to access specific resources through a custom IAM role, maintaining the principle of least privilege. Options A and C provide Editor access, which is too broad and does not adhere to least privilege. Option B does not allow the deployer to act as the service account, limiting its functionality compared to option D.