The TeamCity agent does not actually read environmental data from the operating system. Instead, it reads them from the buildAgent / conf / buildAgent.properties file on your agent machine. At the bottom of this file you will see instructions for adding new variables. Something like that:
# Environment Variables
Once you make this switch on the command line on your agent machine and do something like this:
./agent.sh stop ./agent.sh start
Obviously OS dependent. For Windows there is a .bat file.
This should cause the environment variables to appear in TeamCity.
James source share