Google Professional Cloud Developer Question 432
Single answerGoogle Cloud PlatformYou are developing a cloud-native application on Google Cloud and need to use the Cloud Vision API for image analysis. During testing, you receive a '403: Permission denied' error when trying to call the API. What step should you take to resolve this issue?
- A
Enable the Cloud Vision API in the Google Cloud Console.
- B
Assign the Viewer role to your service account.
- C
Grant the required IAM permissions to your service account.
- D
Enable billing for your Google Cloud project.
Show answer and explanation
Correct answer: A
Explanation
When using Google Cloud services, you must first enable the required APIs in the Google Cloud Console for the project where your application is running. If the API is not enabled, any calls to the API will fail with a '403: Permission denied' error, regardless of IAM permissions or billing status.
- A. Correct.
This is the correct answer. Google Cloud services like Cloud Vision API need to be explicitly enabled in the project before they can be used. Without enabling the service, API calls will result in errors like '403: Permission denied.'
- B. Incorrect.
This is incorrect. Assigning the Viewer role does not grant the necessary permissions to call the Cloud Vision API. The Viewer role provides read-only access to resources in the project, but it does not enable services.
- C. Incorrect.
This is incorrect. While granting IAM permissions is necessary for accessing APIs, the error in this scenario ('403: Permission denied') specifically indicates that the service itself is not enabled, which must be addressed first.
- D. Incorrect.
This is incorrect. While enabling billing is required for using many Google Cloud services, it is not related to the '403: Permission denied' error in this case. The issue is due to the service not being enabled, not a billing problem.