Your on-premises CI server uploads build artifacts to a Cloud Storage bucket in your Google Cloud project. The build job executes every 30 minutes and already runs under a user account that is allowed to impersonate the service account ci-uploader@example. A new security policy forbids storing any long-lived service account key files on the server. Which method will let the job authenticate to Cloud Storage while complying with the policy?
Invoke gcloud auth print-access-token --impersonate-service-account=ci-uploader@example at the start of each build and supply the returned token to gsutil.
Enable Cloud Storage HMAC credentials for ci-uploader@example and embed the secret key pair directly in the build script.
Grant the Storage Object Admin role to the user account that runs the job so it can bypass the service account entirely.
Generate a new JSON key for ci-uploader@example, encrypt it, and decrypt it during each build before running gcloud auth activate-service-account.
Using gcloud auth print-access-token together with the --impersonate-service-account flag produces an OAuth 2.0 access token that is valid for about one hour. Because the token is generated at runtime and never written to disk permanently, it avoids the risks associated with long-lived JSON key files. The other options rely on static keys or bypass the least-privilege model, violating the stated security requirements.
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 the purpose of the --impersonate-service-account flag in gcloud commands?
Open an interactive chat with Bash
How does OAuth 2.0 access tokens improve security when accessing GCP services?
Open an interactive chat with Bash
Why is avoiding static keys like JSON service account keys important in securing build pipelines?
Open an interactive chat with Bash
What does the '--impersonate-service-account' flag do in gcloud commands?
Open an interactive chat with Bash
Why are long-lived JSON key files discouraged in secure environments?
Open an interactive chat with Bash
What is the principle of least privilege, and how does this solution adhere to it?
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 .