Question 123 of 500
Deploying applicationseasyMultiple ChoiceObjective-mapped

Quick Answer

The answer is to use Secret Manager to store and access the database password, as this is the simplest and most secure method for injecting Cloud SQL credentials into Cloud Functions. Secret Manager acts as a centralized vault for sensitive data like database passwords, allowing your Cloud Function to retrieve the secret at runtime via the API or by mounting it as a volume, which completely avoids hardcoding credentials in code or environment variables that could be exposed in logs or source control. On the Google Professional Cloud Developer exam, this question tests your understanding of Google Cloud’s recommended security patterns for serverless compute, often appearing as a trap where less secure options like environment variables or Cloud Storage signed URLs seem tempting. The key memory tip is “Secrets, not strings”—always store sensitive database credentials in Secret Manager rather than embedding them as plain text, ensuring your Cloud Function remains both secure and auditable.

PCD Deploying applications Practice Question

This PCD practice question tests your understanding of deploying applications. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

A developer wants to deploy a Cloud Function that connects to a Cloud SQL database. What is the simplest way to securely inject database credentials?

Question 1easymultiple choice
Full question →

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Use Secret Manager to store and access the database password.

Option C is correct because Secret Manager provides a secure, centralized service for storing sensitive data like database passwords, and the Cloud Function can access the secret at runtime via the Secret Manager API or by mounting it as a volume. This avoids hardcoding credentials in code or environment variables, which can be exposed in logs or source control. It is the simplest and most secure approach recommended by Google Cloud for injecting database credentials into Cloud Functions.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Store credentials in the Cloud Function code as environment variables.

    Why it's wrong here

    Storing credentials in code or env variables is insecure and not recommended.

  • Use Cloud Key Management Service to encrypt credentials and pass them via HTTP headers.

    Why it's wrong here

    Overly complex and not a secure injection pattern.

  • Use Secret Manager to store and access the database password.

    Why this is correct

    Secret Manager provides secure storage and access control for secrets.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Embed credentials in the database connection string in the source code.

    Why it's wrong here

    Hardcoding credentials in source code is a security risk.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates often confuse environment variables (Option A) as a secure method because they are not in source code, but Cisco tests the understanding that environment variables in serverless environments can still be exposed through logs or the console, whereas Secret Manager provides dedicated encryption and access control.

Detailed technical explanation

How to think about this question

Under the hood, Secret Manager stores secrets as encrypted blobs using AES-256 at rest, and access is controlled via IAM roles (e.g., roles/secretmanager.secretAccessor). Cloud Functions can retrieve secrets using the Secret Manager API with a simple HTTP call or by mounting them as a volume in the function's filesystem, which is handled automatically by the Cloud Functions runtime when the secret is referenced in the function's configuration. A real-world scenario is a CI/CD pipeline where the database password must be rotated without redeploying the function; Secret Manager supports versioning, so the function can be updated to reference a new secret version without code changes.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A company's IT admin needs to give a contractor read-only access to production logs without sharing account credentials. Using role-based access control (RBAC) and temporary scoped permissions — not a permanent shared password — is the correct pattern. Questions like this test whether you can apply least-privilege access across cloud identity services.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related PCD practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free PCD practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this PCD question test?

Deploying applications — This question tests Deploying applications — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Use Secret Manager to store and access the database password. — Option C is correct because Secret Manager provides a secure, centralized service for storing sensitive data like database passwords, and the Cloud Function can access the secret at runtime via the Secret Manager API or by mounting it as a volume. This avoids hardcoding credentials in code or environment variables, which can be exposed in logs or source control. It is the simplest and most secure approach recommended by Google Cloud for injecting database credentials into Cloud Functions.

What should I do if I get this PCD question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Keep practising

More PCD practice questions

Last reviewed: Jun 25, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This PCD practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCD exam.