Use NuGet with Azure DevOps Services feeds
Azure DevOps Services
Note
This page covers interactive scenarios. In Azure Pipelines, use the NuGet step to restore and publish packages.
Note
The Azure Artifacts service recommends NuGet 4.8.2 or later. However, Azure Artifacts also supports legacy NuGet 2.x clients. For a complete list of the latest clients, see the NuGet distribution page.
Add a feed to NuGet 4.8.2 or later
NuGet 4.8.2 and later supports the Azure Artifacts Credential Provider, which automatically acquires feed credentials when needed.
Navigate to your feed (or create a feed if you haven't).
Select Connect to feed:
Select NuGet.exe under the NuGet header
Select Get the tools in the top right corner
Follow steps 1 and 2 to download the latest NuGet version and the credential provider.
Follow the instructions in the Project setup, Restore packages, and Publish packages sections to publish.
Note
You can also paste the Project setup XML snippet in your default nuget.config file to use outside of a project.
Follow steps 1, 2, and 3 to get the tools, add the feed to your local NuGet configuration, and push the package.
Then, run any nuget command.
Add a feed to NuGet 2
NuGet 2 uses Personal Access Tokens to access feeds.
To use a 2.x client, first get the v3 feed URL:
Navigate to your feed (or create a feed if you haven't).
Select Connect to feed:
- Copy the NuGet package source URL:
Then, at the end of the URL, replace /v3/index.json
with /v2
.
Generate a Personal Access Token (PAT) using the instructions here. Scope your PAT to the organization(s) you want to access and to one of the following scopes: Packaging (read), Packaging (read and write), or Packaging (read, write, and manage).
We strongly recommend not checking your PAT into source control; anyone with access to your PAT can interact with Azure DevOps Services as you.
Run
nuget.exe sources add -name {your feed name} -source {your feed URL} -username {anything} -password {your PAT}
Then, run any nuget command.
Feedback
Loading feedback...