I have the following error in Azure Pipelines. The error occurred after I updated the packages for Azure Function. The local build works normally and I don't know what to do about it. I use public org and us private feed, but I don't think it should be because of that.
If I do a downgrade, I lose the ability to use Aspire which was a lot of work.
Please does anyone know what to do about this error? Thank you
Use packages:
<PackageReference Include="Aspire.Azure.Data.Tables" Version="8.2.2" />
<PackageReference Include="Aspire.Azure.Storage.Blobs" Version="8.2.2" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.2.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.3.0" />
<PackageReference Include="MassTransit.WebJobs.ServiceBus" Version="8.2.1" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="2.0.0-preview5" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.ServiceBus" Version="5.22.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="2.0.0-preview4" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.0-preview2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
NuGet.config:
<configuration>
<packageSources>
<clear />
<add key="My_Packages" value="https://pkgs.dev.azure.com/myorg/_packaging/My_Packages/nuget/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
</configuration>
Pipeline:
- task: DotNetCoreCLI@2
displayName: Nuget restore
inputs:
command: 'restore'
projects: '${{ parameters.solution }}'
feedsToUse: 'config'
nugetConfigPath: 'NuGet.config'
includeNuGetOrg: true
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: 'build'
projects: ${{ parameters.projects }}
arguments: '--no-restore --configuration ${{ parameters.buildConfiguration }} /p:Version=100.4'
versioningScheme: byBuildNumber
Error log:
2024-11-12T06:36:48.1297294Z myorgInfrastructure -> /home/vsts/work/1/s/Src/myorgInfrastructure/bin/Release/net8.0/myorgInfrastructure.dll
2024-11-12T06:36:55.2336149Z Determining projects to restore...
2024-11-12T06:36:57.9162767Z Failed to download package 'Microsoft.NETCore.Targets.3.0.0' from 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/af41060d-f5f5-4667-8078-42f88f984727/nuget/v3/flat2/microsoft.netcore.targets/3.0.0/microsoft.netcore.targets.3.0.0.nupkg'.
2024-11-12T06:36:57.9163651Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:36:57.9250962Z Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/036f3e9a-7104-43cd-bed3-406a8f5ec881/nuget/v3/flat2/microsoft.netcore.targets/index.json'.
2024-11-12T06:36:57.9251813Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:36:57.9253330Z Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/af41060d-f5f5-4667-8078-42f88f984727/nuget/v3/flat2/microsoft.net.sdk.functions/index.json'.
2024-11-12T06:36:57.9254398Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:36:57.9255212Z Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/036f3e9a-7104-43cd-bed3-406a8f5ec881/nuget/v3/flat2/microsoft.net.sdk.functions/index.json'.
2024-11-12T06:36:57.9260999Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:36:57.9281383Z Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/036f3e9a-7104-43cd-bed3-406a8f5ec881/nuget/v3/flat2/microsoft.azure.webjobs.extensions.servicebus/index.json'.
2024-11-12T06:36:57.9282806Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:36:58.9885054Z Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/036f3e9a-7104-43cd-bed3-406a8f5ec881/nuget/v3/flat2/microsoft.netcore.targets/index.json'.
2024-11-12T06:36:58.9886570Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:36:59.0646797Z Failed to download package 'Microsoft.NETCore.Targets.3.0.0' from 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/af41060d-f5f5-4667-8078-42f88f984727/nuget/v3/flat2/microsoft.netcore.targets/3.0.0/microsoft.netcore.targets.3.0.0.nupkg'.
2024-11-12T06:36:59.0648166Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:36:59.0707665Z Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/af41060d-f5f5-4667-8078-42f88f984727/nuget/v3/flat2/microsoft.net.sdk.functions/index.json'.
2024-11-12T06:36:59.0708533Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:36:59.1675081Z Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/036f3e9a-7104-43cd-bed3-406a8f5ec881/nuget/v3/flat2/microsoft.azure.webjobs.extensions.servicebus/index.json'.
2024-11-12T06:36:59.1676152Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:36:59.1716437Z Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/036f3e9a-7104-43cd-bed3-406a8f5ec881/nuget/v3/flat2/microsoft.net.sdk.functions/index.json'.
2024-11-12T06:36:59.1717367Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:37:00.0717310Z Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/036f3e9a-7104-43cd-bed3-406a8f5ec881/nuget/v3/flat2/microsoft.netcore.targets/index.json'.
2024-11-12T06:37:00.0718455Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:37:00.1428853Z Failed to download package 'Microsoft.NETCore.Targets.3.0.0' from 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/af41060d-f5f5-4667-8078-42f88f984727/nuget/v3/flat2/microsoft.netcore.targets/3.0.0/microsoft.netcore.targets.3.0.0.nupkg'.
2024-11-12T06:37:00.1430092Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:37:00.2077721Z Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/af41060d-f5f5-4667-8078-42f88f984727/nuget/v3/flat2/microsoft.net.sdk.functions/index.json'.
2024-11-12T06:37:00.2079688Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:37:00.2772441Z Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/036f3e9a-7104-43cd-bed3-406a8f5ec881/nuget/v3/flat2/microsoft.net.sdk.functions/index.json'.
2024-11-12T06:37:00.2775145Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:37:00.4521794Z Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/036f3e9a-7104-43cd-bed3-406a8f5ec881/nuget/v3/flat2/microsoft.azure.webjobs.extensions.servicebus/index.json'.
2024-11-12T06:37:00.4522688Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:37:01.2872482Z Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/036f3e9a-7104-43cd-bed3-406a8f5ec881/nuget/v3/flat2/microsoft.netcore.targets/index.json'.
2024-11-12T06:37:01.2873981Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:37:01.3455990Z Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/036f3e9a-7104-43cd-bed3-406a8f5ec881/nuget/v3/flat2/microsoft.net.sdk.functions/index.json'.
2024-11-12T06:37:01.3456511Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:37:01.3719845Z Failed to download package 'Microsoft.NETCore.Targets.3.0.0' from 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/af41060d-f5f5-4667-8078-42f88f984727/nuget/v3/flat2/microsoft.netcore.targets/3.0.0/microsoft.netcore.targets.3.0.0.nupkg'.
2024-11-12T06:37:01.3727381Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:37:01.4158704Z Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/af41060d-f5f5-4667-8078-42f88f984727/nuget/v3/flat2/microsoft.net.sdk.functions/index.json'.
2024-11-12T06:37:01.4159469Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:37:01.5651481Z Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/036f3e9a-7104-43cd-bed3-406a8f5ec881/nuget/v3/flat2/microsoft.azure.webjobs.extensions.servicebus/index.json'.
2024-11-12T06:37:01.5652026Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:37:02.3949763Z Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/036f3e9a-7104-43cd-bed3-406a8f5ec881/nuget/v3/flat2/microsoft.net.sdk.functions/index.json'.
2024-11-12T06:37:02.3950563Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:37:02.4882168Z Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/036f3e9a-7104-43cd-bed3-406a8f5ec881/nuget/v3/flat2/microsoft.netcore.targets/index.json'.
2024-11-12T06:37:02.4883055Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:37:02.5235787Z Failed to download package 'Microsoft.NETCore.Targets.3.0.0' from 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/af41060d-f5f5-4667-8078-42f88f984727/nuget/v3/flat2/microsoft.netcore.targets/3.0.0/microsoft.netcore.targets.3.0.0.nupkg'.
2024-11-12T06:37:02.5236397Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:37:02.6047936Z Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/af41060d-f5f5-4667-8078-42f88f984727/nuget/v3/flat2/microsoft.net.sdk.functions/index.json'.
2024-11-12T06:37:02.6048789Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:37:02.7220818Z Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/036f3e9a-7104-43cd-bed3-406a8f5ec881/nuget/v3/flat2/microsoft.azure.webjobs.extensions.servicebus/index.json'.
2024-11-12T06:37:02.7243458Z Response status code does not indicate success: 401 (Unauthorized).
2024-11-12T06:37:03.5280452Z ##[error]Src/myorgFunctionApp/obj/Release/net8.0/WorkerExtensions/WorkerExtensions.csproj(0,0): Error NU1301: Failed to retrieve information about 'Microsoft.NET.Sdk.Functions' from remote source 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/036f3e9a-7104-43cd-bed3-406a8f5ec881/nuget/v3/flat2/microsoft.net.sdk.functions/index.json'.
2024-11-12T06:37:03.5283254Z /home/vsts/work/1/s/Src/myorgFunctionApp/obj/Release/net8.0/WorkerExtensions/WorkerExtensions.csproj : error NU1301: Failed to retrieve information about 'Microsoft.NET.Sdk.Functions' from remote source 'https://pkgs.dev.azure.com/myorg/f433b8a7-a701-48e9-b916-e4ac90fa6b4b/_packaging/036f3e9a-7104-43cd-bed3-406a8f5ec881/nuget/v3/flat2/microsoft.net.sdk.functions/index.json'.
Full log is here
Due to some settings in your project, it can force the installation of missing packages of dotnet restore during the dotnet build step although you have set the --no-restore
flag.
Refer to this doc: Why is my build, publish, or test step failing to restore packages?
Most dotnet commands, including build, publish, and test include an implicit restore step. This will fail against authenticated feeds, even if you ran a successful dotnet restore in an earlier step, because the earlier step will have cleaned up the credentials it used.
The cause of the NU1301 error is that dotnet restore step will have cleaned up the credentials it used. Then the valid credentials cannot be read in the dotnet build step.
To solve this issue, you can add NuGet Authenticate task before dotnet restore task for NuGet authentication.
Here is an example:
steps:
- task: NuGetAuthenticate@1
displayName: 'NuGet Authenticate'
- task: DotNetCoreCLI@2
displayName: Nuget restore
inputs:
command: 'restore'
projects: '${{ parameters.solution }}'
feedsToUse: 'config'
nugetConfigPath: 'NuGet.config'
includeNuGetOrg: true
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: 'build'
projects: ${{ parameters.projects }}
arguments: '--no-restore --configuration ${{ parameters.buildConfiguration }} /p:Version=100.4'
versioningScheme: byBuildNumber
On the other hand, if your pipeline and feed are in different projects, you need to navigate to Project Settings -> Settings and disable the option: Limit job authorization scope to current project for non-release pipelines.