Google Professional Cloud Developer

Google Professional Cloud Developer

Get started today

Ultimate access to all questions.


How can you secure a Cloud Function to allow authentication for authorized end users via an application while blocking unauthorized access, using Google Sign-In and following Google's recommended best practices?




Explanation:

To secure the Cloud Function while allowing authorized end users to authenticate via Google Sign-In, the best approach is to deploy from a source code repository (a Google-recommended practice for CI/CD and version control) and grant the least privilege required. The roles/cloudfunctions.invoker role allows users to invoke the function without granting unnecessary permissions like viewing or modifying its configuration. Options A, C, and D are incorrect because they either grant insufficient permissions (A), use non-recommended deployment methods (C, D), or provide overly broad access (C, D).