Commit 9c3a748
fix(bigquery): add impersonateServiceAccount to prebuilt config (#2770)
## Summary
Add `BIGQUERY_IMPERSONATE_SERVICE_ACCOUNT` env var support to the
prebuilt BigQuery configuration, enabling service account impersonation
without requiring a custom `--tools-file`.
## Problem
The BigQuery source already supports `impersonateServiceAccount` (added
in #1641 / #906), but the prebuilt config at
`internal/prebuiltconfigs/tools/bigquery.yaml` does not expose it via an
environment variable. This forces users who need impersonation to
abandon `--prebuilt bigquery` entirely and create a custom
`--tools-file` that manually redefines all 9 tools — just to set one
field on the source.
This is a common need for organizations that use service account
impersonation to scope permissions for AI agents, rather than granting
broad access to individual user accounts.
## Solution
Add a single line to the prebuilt BigQuery YAML:
```yaml
impersonateServiceAccount: ${BIGQUERY_IMPERSONATE_SERVICE_ACCOUNT:}
```
The empty default (`:`) means existing users are unaffected — the field
is ignored when the env var is not set, preserving full backward
compatibility.
## Validation
Built the patched binary locally and confirmed:
- Without the env var: `SESSION_USER()` returns the personal account
(unchanged behavior)
- With the env var: `SESSION_USER()` returns the impersonated service
account
## PR Checklist
- [x] Make sure you reviewed
[CONTRIBUTING.md](https://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md)
- [x] Make sure to open an issue as a
[bug/issue](https://github.com/googleapis/genai-toolbox/issues/new/choose)
before writing your code! That way we can discuss the change, evaluate
designs, and agree on the general idea
- [x] Ensure the tests and linter pass
- [x] Code coverage does not decrease (if any source code was changed)
- [x] Appropriate docs were updated (if necessary)
- [x] Make sure to add `!` if this involve a breaking change
🛠️ Fixes #2769
---------
Co-authored-by: kkeefer1 <kyle_keefer@intuit.com>
Co-authored-by: Wenxin Du <117315983+duwenxin99@users.noreply.github.com>1 parent 479d842 commit 9c3a748
3 files changed
Lines changed: 6 additions & 0 deletions
File tree
- docs
- en/integrations/bigquery/prebuilt-configs
- internal/prebuiltconfigs/tools
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
17 | 21 | | |
18 | 22 | | |
19 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
0 commit comments