title | description | ms.assetid | ms.service | ms.topic | ms.date | monikerRange |
---|---|---|---|---|---|---|
Connect to a feed - NuGet.exe |
How to connect to an Azure Artifacts feed |
10665DBC-846E-4192-8CAB-D5A4C6E40C65 |
azure-devops-artifacts |
conceptual |
07/11/2022 |
<= azure-devops |
[!INCLUDE version-lt-eq-azure-devops]
Azure Artifacts allows developers to both publish and download NuGet packages from various sources, including feeds and public registries. You can use it to privately share packages with your team or specific users and also make them publicly accessible, allowing you to share them openly with anyone on the internet.
-
An Azure DevOps organization and a project. Create an organization or a project if you haven't already.
-
Install the latest NuGet version.
-
Install Azure Artifacts Credential Provider.
::: moniker range=">= azure-devops-2019"
-
Select Artifacts and then select your feed.
-
Select Connect to feed.
:::image type="content" source="../media/connect-to-feed-azure-devops-newnav.png" alt-text="Screenshot showing the connect to feed button":::
-
Select NuGet.exe from the left panel.
-
If this is your first time using Azure Artifacts with NuGet.exe, select Get the tools in the top-right corner and follow the instructions to download and install NuGet and Azure Artifacts Credential Provider.
-
Follow the instructions in the Project setup to set up your nuget.config file.
:::image type="content" source="../media/nuget-azure-devops-newnav.png" alt-text="Screenshot showing how to set up your project's config file":::
::: moniker-end
::: moniker range="tfs-2018"
-
Select Build and Release > Packages.
-
Select your feed from the dropdown menu.
-
Select Connect to feed.
:::image type="content" source="../media/connect-to-feed.png" alt-text="Screenshot showing the connect to feed button in TFS":::
-
Select NuGet from the left panel.
-
If this is your first time using Azure Artifacts with NuGet, select the link under Get the tools to download and install NuGet and the Credential Provider.
-
Run the command highlighted in step number two to add your feed URL to your nuget.config file.
:::image type="content" source="../media/nugeturl.png" alt-text="Screenshot showing how to push your package using NuGet.exe in TFS":::
-
Run the command highlighted in step number three if you want to publish your NuGet package.
::: moniker-end
Note
Azure Artifacts Credential Provider is supported with NuGet 4.8.2 or later. See Azure Artifacts Credential Provider for more information.
::: moniker range="azure-devops"
-
Select Artifacts and then select your feed.
-
Select Connect to feed.
:::image type="content" source="../media/connect-to-feed-azure-devops-newnav.png" alt-text="Screenshot showing the connect to feed button":::
-
Select NuGet.exe from the left panel.
-
Copy your source URL, and then replace
/v3/index.json
with/v2
.:::image type="content" source="../media/nuget-consume-url-azure-devops-newnav.png" alt-text="Screenshot showing the source URL":::
-
Create a Personal Access Token. 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).
-
Run the following command in an elevated command prompt window to add your package source:
nuget sources add -name <Feed_Name> -source <Feed_URL> -username <Any_String_But_Not_Null> -password <Personal_Access_Token>
-
If your organization is connected to Microsoft Entra ID, you must first authenticate with your AD credentials and then add your personal access token using the setapikey command:
nuget sources add -name <Feed_Name> -source <Feed_URL> -username <Azure_Active_Directory_UserName> -password <Azure_Active_Directory_Password> nuget setapikey <Personal_Access_Token> -source <Feed_URL>
::: moniker-end
::: moniker range="tfs-2018"
-
Select Build and Release > Packages.
-
Select your feed from the dropdown menu.
-
Select Connect to feed.
:::image type="content" source="../media/connect-to-feed.png" alt-text="Screenshot of the connect to feed button in TFS":::
-
Select NuGet and then copy your source URL. Replace
/v3/index.json
with/v2
.:::image type="content" source="../media/nuget-consume-url.png" alt-text="Screenshot showing how to get the source URL":::
-
Create a Personal Access Token. 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).
-
Run the following command in an elevated command prompt window to add your package source:
nuget sources add -name <Feed_Name> -source <Feed_URL> -username <Any_String_But_Not_Null> -password <Personal_Access_Token>
-
If your organization is connected to Microsoft Entra ID, you must first authenticate with your AD credentials and then add your personal access token using the setapikey command:
nuget sources add -name <Feed_Name> -source <Feed_URL> -username <Azure_Active_Directory_UserName> -password <Azure_Active_Directory_Password> nuget setapikey <Personal_Access_Token> -source <Feed_URL>
::: moniker-end