I have set Up a project in teamcity 8 that requires nuget package restore, and I have also added two build steps, one for the Nuget installer and for MsBuild.
Since we need to connect via a proxy, I have also set this in the Nuget.config file under the config tag using the commandline tool.
However, when I build the project inside teamcity, I am unable to restore the packages.
I get the following error:

But when I try to run the command directly from the commandline, the nuget packages are restored successfully.
Are there extra settings I need to have in teamcity in order for this to work ? I already added an enviroment variable to enable nuget package restore if that helps.
You will most likely need a domain account to run the service as.
Have a domain account created, such as "teamcity", and then set the services to run as that user.
Then, you can log in as that user on your build agent and verify that you're able to do what you need to do, adding permissions as needed until you get it to work.
See the TeamCity documentation for more information about the permissions your user will need.