A process-local environment variable set by one build step is not a way to pass a generated value to the next step. Print a TeamCity `setParameter` service message to standard output:

```text
##teamcity[setParameter name='env.PASSED_ID' value='the-id-here']
```

The parameter is available to subsequent steps as `PASSED_ID` in the environment. Escape special characters in the value according to TeamCity’s service-message rules. Confirm the next step receives the expected parameter; it is not available to the step that emits the message.