I am trying to retrieve a custom NuGet package that I have pushed into a Azure DevOps Artifacts (project)feed.
But the NuGetCommand@2 fails with error:
NU1301: Unable to load the service index for source https://pkgs.dev.azure.com/[COMPANY_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json.
My build yaml file has got following steps:
- task: NuGetToolInstaller@1
# Required for custom access to Artifacts
displayName: "Install Artifacts Provider"
Write-Host "Install Artifacts Provider"
Invoke-Expression "& { $(irm https://aka.ms/install-artifacts-credprovider.ps1) } -AddNetfx"
- task: NuGetAuthenticate@1
restoreSolution: '$(solution)'
<code>steps:
- task: NuGetToolInstaller@1
# Required for custom access to Artifacts
- task: PowerShell@2
displayName: "Install Artifacts Provider"
inputs:
targetType: 'inline'
script: |
Write-Host "Install Artifacts Provider"
Invoke-Expression "& { $(irm https://aka.ms/install-artifacts-credprovider.ps1) } -AddNetfx"
- task: NuGetAuthenticate@1
- task: NuGetCommand@2
inputs:
command: 'restore'
FeedsToUse: 'select'
restoreSolution: '$(solution)'
vstsFeed: [FEED_NAME]
</code>
steps:
- task: NuGetToolInstaller@1
# Required for custom access to Artifacts
- task: PowerShell@2
displayName: "Install Artifacts Provider"
inputs:
targetType: 'inline'
script: |
Write-Host "Install Artifacts Provider"
Invoke-Expression "& { $(irm https://aka.ms/install-artifacts-credprovider.ps1) } -AddNetfx"
- task: NuGetAuthenticate@1
- task: NuGetCommand@2
inputs:
command: 'restore'
FeedsToUse: 'select'
restoreSolution: '$(solution)'
vstsFeed: [FEED_NAME]
In my nuget.config file I have the following configuration:
<code><?xml version="1.0" encoding="utf-8"?>
<add key="[FEED_NAME]" value="https://pkgs.dev.azure.com/[COMPANY_NAME]/[PROJECT_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json" />
<packageSourceCredentials>
<add key="Username" value="[USER_NAME]" />
<add key="Password" value="[PAC]" />
</packageSourceCredentials>
<code><?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="[FEED_NAME]" value="https://pkgs.dev.azure.com/[COMPANY_NAME]/[PROJECT_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json" />
</packageSources>
<packageSourceCredentials>
<[FEED_NAME]%>
<add key="Username" value="[USER_NAME]" />
<add key="Password" value="[PAC]" />
</[FEED_NAME]>
</packageSourceCredentials>
</configuration>
</code>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="[FEED_NAME]" value="https://pkgs.dev.azure.com/[COMPANY_NAME]/[PROJECT_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json" />
</packageSources>
<packageSourceCredentials>
<[FEED_NAME]%>
<add key="Username" value="[USER_NAME]" />
<add key="Password" value="[PAC]" />
</[FEED_NAME]>
</packageSourceCredentials>
</configuration>
Under the artifact permissions settings I have given the project build service the collaborator role.
With this setup I get the following messages in the log:
The NuGetAuthenticate step gives this output and is successfull:
<code>Setting up the credential provider to use the identity '[PROJECT_NAME] Build Service ([COMPANY_NAME])' for feeds in your organization/collection starting with:
https://pkgs.dev.azure.com/[COMPANY_NAME]/
https://[COMPANY_NAME].pkgs.visualstudio.com/
<code>Setting up the credential provider to use the identity '[PROJECT_NAME] Build Service ([COMPANY_NAME])' for feeds in your organization/collection starting with:
https://pkgs.dev.azure.com/[COMPANY_NAME]/
https://[COMPANY_NAME].pkgs.visualstudio.com/
</code>
Setting up the credential provider to use the identity '[PROJECT_NAME] Build Service ([COMPANY_NAME])' for feeds in your organization/collection starting with:
https://pkgs.dev.azure.com/[COMPANY_NAME]/
https://[COMPANY_NAME].pkgs.visualstudio.com/
The NuGetCommand step fails with following log:
<code>Using D:a_tasksNuGetCommand_333b11bd-d341-40d9-afcf-b32d5ce6f23b2.238.1CredentialProviderV2pluginsnetfxCredentialProvider.MicrosoftCredentialProvider.Microsoft.exe as a credential provider plugin.
C:Program Filesdotnetlibrary-packs
https://api.nuget.org/v3/index.json
https://pkgs.dev.azure.com/[COMPANY_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json
[CredentialProvider]Handling 'Request' 'GetAuthenticationCredentials'. Time elapsed in ms: 4 - Payload: {"Uri":"https://pkgs.dev.azure.com/[COMPANY_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json","IsRetry":false,"IsNonInteractive":true,"CanShowDialog":true}
[CredentialProvider]Creating a progress reporter with interval: 00:00:02
[CredentialProvider]Handling auth request, Uri: https://pkgs.dev.azure.com/[COMPANY_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json, IsRetry: False, IsNonInteractive: True, CanShowDialog: True
[CredentialProvider]URI: https://pkgs.dev.azure.com/[COMPANY_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json
[CredentialProvider]VstsBuildTaskServiceEndpointCredentialProvider - This credential provider must be run under the Team Build tasks for NuGet with external endpoint credentials. Appropriate environment variable needs to be set.
[CredentialProvider]Skipping NuGetCredentialProvider.CredentialProviders.VstsBuildTaskServiceEndpoint.VstsBuildTaskServiceEndpointCredentialProvider, cannot provide credentials for https://pkgs.dev.azure.com/[COMPANY_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json
NU1301: Unable to load the service index for source https://pkgs.dev.azure.com/[COMPANY_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json.
<code>Using D:a_tasksNuGetCommand_333b11bd-d341-40d9-afcf-b32d5ce6f23b2.238.1CredentialProviderV2pluginsnetfxCredentialProvider.MicrosoftCredentialProvider.Microsoft.exe as a credential provider plugin.
Feeds used:
C:Program Filesdotnetlibrary-packs
https://api.nuget.org/v3/index.json
https://pkgs.dev.azure.com/[COMPANY_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json
...
[CredentialProvider]Handling 'Request' 'GetAuthenticationCredentials'. Time elapsed in ms: 4 - Payload: {"Uri":"https://pkgs.dev.azure.com/[COMPANY_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json","IsRetry":false,"IsNonInteractive":true,"CanShowDialog":true}
[CredentialProvider]Creating a progress reporter with interval: 00:00:02
[CredentialProvider]Handling auth request, Uri: https://pkgs.dev.azure.com/[COMPANY_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json, IsRetry: False, IsNonInteractive: True, CanShowDialog: True
[CredentialProvider]URI: https://pkgs.dev.azure.com/[COMPANY_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json
[CredentialProvider]VstsBuildTaskServiceEndpointCredentialProvider - This credential provider must be run under the Team Build tasks for NuGet with external endpoint credentials. Appropriate environment variable needs to be set.
...
[CredentialProvider]Skipping NuGetCredentialProvider.CredentialProviders.VstsBuildTaskServiceEndpoint.VstsBuildTaskServiceEndpointCredentialProvider, cannot provide credentials for https://pkgs.dev.azure.com/[COMPANY_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json
...
NU1301: Unable to load the service index for source https://pkgs.dev.azure.com/[COMPANY_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json.
</code>
Using D:a_tasksNuGetCommand_333b11bd-d341-40d9-afcf-b32d5ce6f23b2.238.1CredentialProviderV2pluginsnetfxCredentialProvider.MicrosoftCredentialProvider.Microsoft.exe as a credential provider plugin.
Feeds used:
C:Program Filesdotnetlibrary-packs
https://api.nuget.org/v3/index.json
https://pkgs.dev.azure.com/[COMPANY_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json
...
[CredentialProvider]Handling 'Request' 'GetAuthenticationCredentials'. Time elapsed in ms: 4 - Payload: {"Uri":"https://pkgs.dev.azure.com/[COMPANY_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json","IsRetry":false,"IsNonInteractive":true,"CanShowDialog":true}
[CredentialProvider]Creating a progress reporter with interval: 00:00:02
[CredentialProvider]Handling auth request, Uri: https://pkgs.dev.azure.com/[COMPANY_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json, IsRetry: False, IsNonInteractive: True, CanShowDialog: True
[CredentialProvider]URI: https://pkgs.dev.azure.com/[COMPANY_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json
[CredentialProvider]VstsBuildTaskServiceEndpointCredentialProvider - This credential provider must be run under the Team Build tasks for NuGet with external endpoint credentials. Appropriate environment variable needs to be set.
...
[CredentialProvider]Skipping NuGetCredentialProvider.CredentialProviders.VstsBuildTaskServiceEndpoint.VstsBuildTaskServiceEndpointCredentialProvider, cannot provide credentials for https://pkgs.dev.azure.com/[COMPANY_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json
...
NU1301: Unable to load the service index for source https://pkgs.dev.azure.com/[COMPANY_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json.
The strange part is that all source URL have removed the project name.
Instead of
https://pkgs.dev.azure.com/[COMPANY_NAME]/[PROJECT_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json
he uses the url without the project name:
https://pkgs.dev.azure.com/[COMPANY_NAME]/_packaging/[FEED_NAME]/nuget/v3/index.json