The Simplest Way to Make Azure Bicep and Teamcity Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Pairing azure bicep and teamcity lets teams build and update cloud apps through code. TeamCity runs build steps that turn Bicep files into live cloud resources. This setup keeps cloud changes in version control and removes manual portal clicks. Your team can test, review, and ship cloud updates in a repeatable pipeline. How login and data flow between azure bicep and teamcity TeamCity starts a build when a developer pushes Bicep files to a source repo. The build agent pulls those files and p

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Pairing azure bicep and teamcity lets teams build and update cloud apps through code. TeamCity runs build steps that turn Bicep files into live cloud resources.

This setup keeps cloud changes in version control and removes manual portal clicks. Your team can test, review, and ship cloud updates in a repeatable pipeline.

How login and data flow between azure bicep and teamcity

TeamCity starts a build when a developer pushes Bicep files to a source repo. The build agent pulls those files and prepares them for the cloud API.

Before any cloud change happens, the build agent must log in to Azure. Teams set up a service principal or use workload identity federation for this step.

Workload identity federation lets TeamCity trade a build token for a short cloud token. This flow avoids storing static passwords inside the build server settings.

Once logged in, the agent compiles the Bicep file into a standard JSON template. The agent then sends that template to the Azure Resource Manager API.

Azure checks the template against the role permissions tied to the build identity. If the role allows the change, Azure creates or updates the target resources.

Status logs flow back from the cloud API to the TeamCity build log. Developers can read these logs to check if the cloud update worked.

Common failure modes and how to scope roles

Many teams fail by giving one shared service account to every TeamCity project. A broad role on that account lets any build touch production resources.

Static client secrets also cause broken builds when keys expire without warning. If someone leaks a static key, an attacker can change your cloud setup.

Azure RBAC + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Unlogged manual fixes create drift between your Bicep files and the live cloud. When the next TeamCity build runs, it may overwrite those manual changes.

To fix these risks, give each TeamCity project its own cloud identity. Scope each role to one resource group instead of the whole subscription.

Grant only the exact permissions needed to deploy the resources in that Bicep file. Use separate build agents for test and production jobs to isolate network paths.

Place private build agents inside a virtual network when working with private cloud endpoints. Set up branch rules in TeamCity so only reviewed code runs against production.

Testing cloud templates before deployment

Running raw templates straight into production can break live databases or network rules. You should add a check step in TeamCity before the real deployment runs.

First, have the build agent run a linter to catch syntax mistakes early. This step checks the Bicep file rules without needing a live cloud login.

Next, run a preview step that asks Azure to compare the template with live state. Azure returns a list of resources it plans to add, change, or delete.

TeamCity can save this preview output as a build artifact for team review. A lead engineer can check the list before approving the final production step.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

How should TeamCity log in to Azure for Bicep runs?

Use OpenID Connect workload identity federation between your TeamCity server and Azure. This method trades short tokens per build so you never store static secrets.

How do we stop a test build from changing production resources?

Create separate identities for test and production projects in TeamCity. Scope each identity role to its own resource group and restrict production builds to main branches.

Where does Bicep template compilation happen during a build?

The TeamCity build agent compiles the Bicep file into JSON on the agent machine. The agent then sends that compiled JSON payload to the Azure API.

The query runs. The emails stay hidden.