Dotnet restore failing on azure pipeline due to not being able to load internal nuget feed

98 Views Asked by At

My problem is basically that I get an error NU1301: Unable to load the service index for source myPrivateFeedUrl. when running dotnet restore on my pipeline

Yet above, it can match the package source:

        Package source mapping matches found for package ID 'myPrivatePackage' are: 'myPrivateFeed'

This is happening on a TFS hosted on one of our VMs, also with an azure self hosted agent on another machine

my pipeline yaml

pool:
  name: 'pool'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'
  

steps:
- task: CmdLine@2
  inputs:
    script: |
      cd $(Agent.BuildDirectory)/s/AppName.App/
      
      dir
      
      dotnet restore --verbosity diagnostic
  env:
      HTTPS_PROXY: "corporate proxy here"
      NO_PROXY: "proxy exceptions here"
- task: DotNetCoreCLI@2
  displayName: 'Build Solution'
  inputs:
    command: 'build'
    projects: '**/project.csproj'

my nuget.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <packageSources>
        <clear />
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
        <add key="privateFeed" value="privateFeedUrl" />
    </packageSources>
    <packageSourceMapping>
        <packageSource key="nuget.org">
            <package pattern="*" />
        </packageSource>
        <packageSource key="privateFeed">
            <package pattern="privatePackagePrefix.*" />
        </packageSource>
    </packageSourceMapping>
</configuration>

things I've tried:

adding the corporate proxy

adding required certificates to agent machine

disabling:

Limit job authorization scope to current project for non-release pipelines

Limit job authorization scope to current project for release pipelines

running dotnet restore on the agent work folder (it works instantly)

adding nuget authenticate before doing a dotnet restore

same result despite all of that.

Edit:

Permission screen screenshot as requested by one of the comments:

feed permissions screen

0

There are 0 best solutions below