...
First, you need to go to your TeamCity server, click on your username at the header, then go go to My Profile.
Here you click on the Access Tokens in the navigation bar . There you click Create and go to the page where you can create an access token.
Then you state the token name and its expiration date or leave it blank in case you don't want it to expire.
...