Monday 24 February 2020

Setting up Azure Devops on premise to access Nuget over proxy


  • Need to add proxy settings to the nuget.config file; this has to be done using the nuget command line (as it will encrypt the password for the user)
  • To do this need to determine what user the build agent is running as – each user has their own nuget.config file
  • You can’t copy another nuget.config file – the password for the proxy is encrypted and is done at a user level – e.g. if you are logged in as userX and encrypt the password and copy the values to the config for userY who is setup to run the build agent, then the build wouldn’t be able to decrypt it. So, you have to login/RDP to the devops machine as the user the build agent is running as and setup the nuget.config while logged in as that user.
  • If the build agent as running as Network Service change it do a service account in the services control panel (I guess! That's what I did)
  • RDP in and run nuget.exe. If you can find it. I found it as part of a previous package. Otherwise have to install manually? Doesn’t appear to be exposed as part of the azure devops install.
  • Use ‘nuget config’ commands
    • Nuget config –Set http_proxy=http://myproxy.do.com:3128
    • Nuget config –Set http_proxy.user=domain\myserviceaccount
    • Nuget config –Set http_proxy.password=mypassword
  • The password will be automatically encrypted in the nuget.config file
  • Can have a look in the config file C:\Users\[serviceaccount]\AppData\Roaming\NuGet\
  • Restart the agent service?