Subdomain 1.4: Authenticating through OAuth to access the data in dbt
1.Scenario: Your organization uses BigQuery. Developers are working locally using dbt Core. The security team has blocked the creation and download of Service Account JSON keys to developer laptops to prevent credential leakage. Developers have the Google Cloud SDK installed locally. Which configuration in `profiles.yml` allows developers to run dbt models locally while adhering to this security constraint?
- A.Set `method: service-account` and point `keyfile` to the system root.
- B.Set `method: oauth` and run `gcloud auth application-default login` to generate local credentials.
- C.Set `method: iam-user` and provide the user's Google Workspace password in plain text.
- D.Set `method: service-account-json` and paste the content of the key into an environment variable.
Show answer & explanation
Correct answer: B — Set `method: oauth` and run `gcloud auth application-default login` to generate local credentials.
- A. Incorrect. The `service-account` method requires a physical JSON keyfile on the local machine. The security policy explicitly prohibits the creation and storage of these files on developer laptops, and pointing to the system root does not bypass the requirement for the file to exist.
- B. Correct. By setting `method: oauth`, dbt-bigquery searches for credentials using the Application Default Credentials (ADC) strategy. Running `gcloud auth application-default login` allows developers to authenticate via their browser and stores a short-lived token locally. This satisfies the security constraint because it does not require the creation or storage of permanent service account JSON keys.
- C. Incorrect. There is no `iam-user` method in dbt's BigQuery adapter that utilizes plain-text passwords. This would be a significant security risk and is not a supported authentication flow for BigQuery.
- D. Incorrect. While storing a JSON key in an environment variable avoids a physical file on the filesystem, the security team has blocked the *creation* of these keys entirely. Furthermore, storing long-lived service account secrets in environment variables still presents a credential leakage risk.