Your organization is automating nightly exports from BigQuery to Cloud Storage using a Python script that runs on a Compute Engine VM. The job must run unattended, and access cannot rely on any employee's personal credentials. Which approach best provides the VM an identity that can be granted the required Storage and BigQuery permissions while following Google-recommended practices?
Create a Google Group that includes the VM instance and grant the required IAM roles to the group.
Enable OS Login on the VM and have a developer run gcloud auth application-default login so the script uses the developer's credentials.
Attach a user-managed service account to the VM instance and grant that service account Storage Object Admin and BigQuery Job User roles.
Generate a long-lived OAuth 2.0 client ID and secret, store them in instance metadata, and have the script request user tokens at each run.
Google Cloud recommends giving non-human workloads their own service account identity. A user-managed service account can be attached to the VM so that the script automatically obtains short-lived tokens without embedding user credentials. You then grant IAM roles such as Storage Object Admin and BigQuery Job User to that service account. OS Login with Application Default Credentials or OAuth client secrets still depend on a human user, and a Google Group cannot act as an identity for a VM instance. Therefore, attaching a dedicated service account is the appropriate solution.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is a user-managed service account in GCP?
Open an interactive chat with Bash
How does IAM help in granting permissions to a service account?
Open an interactive chat with Bash
Why are short-lived tokens more secure than long-lived credentials?
Open an interactive chat with Bash
What is a service account in Google Cloud Platform?
Open an interactive chat with Bash
What are IAM roles in Google Cloud, and how do they work with service accounts?
Open an interactive chat with Bash
Why is using a service account preferable to embedding user credentials in a script?
Open an interactive chat with Bash
GCP Associate Cloud Engineer
Configuring access and security
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .