The Simplest Way to Make Teamcity and Windows Server 2022 Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

You pair teamcity and windows server 2022 by running build agents on the host OS. This setup compiles .NET apps, runs tests, and deploys Windows services on each commit. Many teams struggle when they set up these two tools in production. Build jobs fail when local accounts lack the right folder or registry permissions. Security teams also worry when build agents run with full admin rights. A clean setup gives each build agent only the rights it needs. How teamcity and windows server 2022 shar

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.

You pair teamcity and windows server 2022 by running build agents on the host OS. This setup compiles .NET apps, runs tests, and deploys Windows services on each commit.

Many teams struggle when they set up these two tools in production. Build jobs fail when local accounts lack the right folder or registry permissions. Security teams also worry when build agents run with full admin rights. A clean setup gives each build agent only the rights it needs.

How teamcity and windows server 2022 share work and permissions

The central server holds your build steps, triggers, and project keys. The Windows machine runs an agent service that polls the server for work. You can also set the server to push jobs straight to the agent. Both directions use HTTP or HTTPS over a single network port.

When a job starts, the server sends build steps to the Windows agent. The agent pulls source code from your git host onto the local disk. Next, it starts Windows tools like MSBuild or PowerShell to compile the app. When the job ends, the agent sends logs and files back to the server.

Identity and permissions matter at every step of this flow. The Windows service needs a dedicated user account to run on the host. This user must read and write to the agent work folder. It also needs rights to start compilers and read local certs. The server uses a unique token to trust each registered Windows agent.

Common failure modes and how to scope roles

The biggest mistake is running the Windows build service as Local System. Local System has full control over the host machine and its files. Any developer who can edit a build script can then rule the host. They could read keys from other projects or change host settings.

Shared domain admin accounts cause even bigger risks across your network. If an attacker steals that key from a build log, they own the domain. Broad personal tokens on the build server also create huge blind spots. When every agent shares one token, you cannot trace who ran what job.

Kubernetes API Server Access + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Fix this by creating a local or domain user with minimal rights. Grant this user read and write access only to the build directory. Block this account from logging in through a desktop session. Give each project its own agent pool so teams do not share hosts.

Next, lock down the network paths between the server and the agents. Use Windows Defender Firewall rules to block all unused inbound ports. Allow traffic only between the build server IP and the agent port. Turn on TLS so no one can read build keys on the wire.

Managing build secrets and audit trails on Windows hosts

Build jobs often need database passwords or cloud keys to finish tests. Do not store these raw values in plain text files on the Windows disk. Keep them in the central parameter store and mark them as hidden values. The server will scrub those values from the build logs before saving them.

You should also clean the agent work folder after sensitive jobs finish. Old files left on the disk can leak data to the next build job. Turn on Windows event logs to track every process the build user starts. Send those logs to a central store so your team can review them.

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

Should I run the build agent as a Windows service or a process?

Run the agent as a Windows service for most production workloads. A service starts on boot without a user logging into the desktop. Use an interactive process only when your tests must draw UI windows on screen.

How do I stop one project from reading another project's files on Windows?

Put agents for different teams on separate virtual machines and agent pools. Enable the clean checkout setting so the agent wipes the folder between builds. Scope the service account so it cannot read outside its own work folder.

Check if a firewall rule or antivirus scan blocks the agent port. Make sure the host clock matches the server clock via network time sync. Also check that the agent has enough free disk space and memory to answer pings.

The query runs. The emails stay hidden.