Skip to content

Commit a5c94b3

Browse files
authored
Remove NuGet.org package source (Azure#53264)
Also added guidance for handling unauthorized access to NuGet feeds, including authentication methods and package source mapping.
1 parent 0d709bb commit a5c94b3

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

CONTRIBUTING.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- Install Visual Studio 2022 (Community or higher) and make sure you have the latest updates (https://www.visualstudio.com/).
66
- Install the **.NET desktop development** workload in VisualStudio
77
- Need at least .NET Framework 4.6.2 and 4.7.1 development tools
8-
- Install **.NET 9.0.102 SDK** for your specific [platform](https://dotnet.microsoft.com/download). (or a higher version within the 9.0.*** band)
8+
- Install **.NET 9.0.306 SDK** for your specific [platform](https://dotnet.microsoft.com/download). (or a higher version within the 9.0.*** band)
99
- Install the latest version of git (https://git-scm.com/downloads)
1010
- Install [PowerShell](https://docs.microsoft.com/powershell/scripting/install/installing-powershell), version 7 or higher, if you plan to make public API changes or are working with generated code snippets.
1111
- Install [NodeJS](https://nodejs.org/) (22.x.x) if you plan to use [C# code generation](https://github.com/Azure/autorest.csharp).
@@ -306,6 +306,32 @@ You can add the dev feed to your NuGet.Config file, which can be at the Solution
306306

307307
> You can place a NuGet.Config file in the root of your solution. Projects within the solution will use the feed defined in that file.
308308
309+
##### Unauthorized access to the feed
310+
311+
If you are getting a 401 error, similar to `401 (Unauthorized - No local versions of package "xyz"; please provide authentication to access versions from upstream that have not yet been saved to your feed.)` it means you are trying
312+
to access a package version that is not on the feed but is on the upstream feed `nuget.org` and you don't have permissions to pull that version into the feed. There are two possible solutions to this issue:
313+
314+
1. If you are a member of the team with access and want to update a version of the package in the feed you will need to authenticate to the feed. For local authentication you will want to use [Azure Artifacts Credential Provider](https://github.com/microsoft/artifacts-credprovider#azure-artifacts-credential-provider).
315+
If you need to authenticate a pipeline in our teams DevOps org you will want login via the [NuGetAuthenticate](https://learn.microsoft.com/azure/devops/pipelines/tasks/package/nuget-authenticate?view=azure-devops#dotnet) task.
316+
1. If you are external user and just want to consume packages in the feed you can scope the packages for the feed to just the ones you want by using [packageSourceMapping](https://learn.microsoft.com/nuget/reference/nuget-config-file#packagesource) similar to:
317+
```xml
318+
<?xml version="1.0" encoding="utf-8"?>
319+
<configuration>
320+
<packageSources>
321+
<clear />
322+
<add key="Azure SDK for .NET Dev Feed" value="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json" />
323+
</packageSources>
324+
<disabledPackageSources>
325+
<clear />
326+
</disabledPackageSources>
327+
<packageSourceMapping>
328+
<packageSource key="Azure SDK for .NET Dev Feed">
329+
<package pattern="Azure.*" />
330+
</packageSource>
331+
</packageSourceMapping>
332+
</configuration>
333+
```
334+
309335
### 2. Find NuGet Package
310336

311337
You can use the following options to find the available dev feed packages:

NuGet.Config

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
<configuration>
33
<packageSources>
44
<clear />
5-
<!-- Do not add any additional feeds if new packages are needed they need to come from nuget.org or our azure-sdk-for-net DevOps feed -->
6-
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
5+
<!-- Do not add any additional feeds if new packages are needed they need to come from our azure-sdk-for-net DevOps feed which has an upstream set to nuget.org -->
76
<add key="azure-sdk-for-net" value="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json" />
87
</packageSources>
98
<disabledPackageSources>

0 commit comments

Comments
 (0)