---
title: "TeamCity"
description: "Use Ennote secrets in TeamCity: store an Ennote token as a password parameter exposed as an environment variable, and inject secrets into build steps with ennote secret get."
canonical_url: "https://docs.ennote.io/guides/ci-cd/teamcity"
---
# TeamCity

> Use Ennote secrets in TeamCity: store an Ennote token as a password parameter exposed as an environment variable, and inject secrets into build steps with ennote secret get.

## How it works

TeamCity stores one Ennote token as a password parameter. Parameters that start with `env.` are passed to build steps as environment variables, so the CLI finds `ENNOTE_TOKEN` automatically. `ennote secret get <secret> -- <command>` then runs the command with the keys of the secret as environment variables. See the [CI/CD overview](https://docs.ennote.io/guides/ci-cd/overview) for the common setup.

## 1. Create a token

Create a [Personal Access Token](https://docs.ennote.io/docs/auth/user-tokens) with an expiration, and copy it.

## 2. Store it in TeamCity

In the project (or build configuration) settings, open **Parameters → Add new parameter** and add:

<table>
<thead>
  <tr>
    <th>
      Name
    </th>
    
    <th>
      Kind
    </th>
    
    <th>
      Value
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        env.ENNOTE_TOKEN
      </code>
    </td>
    
    <td>
      Environment variable, spec <strong>
        Password
      </strong>
    </td>
    
    <td>
      the token
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        env.ENNOTE_ORGANIZATION_ID
      </code>
    </td>
    
    <td>
      Environment variable
    </td>
    
    <td>
      your organization ID
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        env.ENNOTE_WORKSPACE_ID
      </code>
    </td>
    
    <td>
      Environment variable
    </td>
    
    <td>
      your workspace ID
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        env.ENNOTE_DO_NOT_TRACK
      </code>
    </td>
    
    <td>
      Environment variable
    </td>
    
    <td>
      <code>
        1
      </code>
    </td>
  </tr>
</tbody>
</table>

A **Password** parameter is hidden in the UI and masked in build logs. Parameters set on the project are inherited by all its build configurations.

## 3. Install the CLI on your agents

TeamCity agents often run without root. Install the CLI once on each agent, or in the agent image, as root:

```bash
curl -sSfL https://get.ennote.io/get-cli.sh | sh
```

## 4. Add the build steps

Add a **Command Line** build step with **Custom script**:

```bash
ennote secret get db-credentials -- npm run migrate
ennote secret get aws -- ./deploy.sh
```

Replace `db-credentials` and `aws` with your secret names.

## Kotlin DSL

If you keep your settings in Kotlin DSL, the same configuration looks like this. Generate a secure token for the Ennote token in **Project Settings → Versioned Settings → Tokens** and reference it by its `credentialsJSON:` ID, so the value is not stored in your repository:

```kotlin [.teamcity/settings.kts]
object Deploy : BuildType({
    name = "Deploy"

    params {
        password("env.ENNOTE_TOKEN", "credentialsJSON:<token-id>")
        param("env.ENNOTE_ORGANIZATION_ID", "org_123")
        param("env.ENNOTE_WORKSPACE_ID", "wrk_prod")
        param("env.ENNOTE_DO_NOT_TRACK", "1")
    }

    steps {
        script {
            name = "Deploy"
            scriptContent = "ennote secret get aws -- ./deploy.sh"
        }
    }
})
```

## FAQ

### Do I need `ennote auth login` on the agent?

No. With `ENNOTE_TOKEN` set, the CLI authenticates headlessly ([ennote auth](https://docs.ennote.io/cli/commands/auth)).

<need-help>



</need-help>


## Sitemap

See the full [sitemap](https://docs.ennote.io/sitemap.md) for all pages.
