You know that pit in your stomach when you realize a secret key has slipped into your build logs? That’s how most teams meet GCP Secret Manager for the first time. Add TeamCity to the mix, and suddenly you’re juggling build agents, tokens, and access scopes just to keep credentials out of source control. Thankfully, there’s a cleaner way to connect the two.
GCP Secret Manager stores sensitive values like API keys, tokens, and certs inside Google Cloud’s encrypted vault. TeamCity, JetBrains’ veteran CI/CD runner, can access those secrets during build time without anyone pasting keys into configuration fields. When GCP Secret Manager and TeamCity line up properly, you get reliable automation with zero secret sprawl.
Here’s how the relationship works in practice. A TeamCity build agent triggers a job, authenticated via Google service account credentials or Workload Identity Federation. Instead of embedding secrets in pipelines, the build requests values from GCP Secret Manager at runtime. Each request is logged, policy-checked, and auditable. No developer sees the secret directly, yet the pipeline can fetch what it needs. It’s identity-based, not configuration-based, which means fewer leak points and better observability.
The trickiest part is permission mapping. Each build agent should assume only the minimal role needed to read a subset of secrets. Avoid using Owner or Editor roles; stick with fine-grained IAM bindings per secret version. If something breaks, error messages will tell you which IAM policy fails, not the secret itself. Rotate keys regularly and pin versions in TeamCity parameters for consistent builds.
Key benefits of GCP Secret Manager TeamCity integration: