Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Azure DevOps Services | Azure DevOps Server | Azure DevOps Server 2022 | Azure DevOps Server 2020
Azure Artifacts enables developers to download NuGet packages from various sources such as private feeds and public registries. You can publish packages to private feeds and control access, or create public feeds to share them openly. This article guides you through authenticating with to your Azure Artifacts feed.
Prerequisites
| Product | Requirements |
|---|---|
| Azure DevOps | - An Azure DevOps organization. - An Azure DevOps project. - An Azure Artifacts feed. - Download and install the Azure Artifacts Credential Provider. - Install the latest NuGet version. |
Project setup
Sign in to your Azure DevOps collection, and then navigate to your project.
Select Artifacts, and then select your feed from the dropdown menu.
Select Connect to Feed, and then select NuGet.exe from the left navigation pane.
Add a nuget.config file to your project, place it in the same folder as your csproj or sln file, and then paste the snippet provided in the Project setup section into your file.
Note
The Azure Artifacts Credential Provider requires NuGet version 4.8.0.5385 or higher. For optimal performance, Azure Artifacts recommends using NuGet version 5.5.x or later, as it includes crucial bug fixes related to cancellations and timeouts.
Authenticate using Service Principals
To authenticate with an Azure Artifacts feed using a service principal, set the ARTIFACTS_CREDENTIALPROVIDER_FEED_ENDPOINTS environment variable as shown below.
This specifies your feed URL, the service principal's application (client) ID, and either the subject name or the file path of the service principal certificate (only one of these two is required).
$env:ARTIFACTS_CREDENTIALPROVIDER_FEED_ENDPOINTS = @'{
"endpointCredentials": [
{
"endpoint": "<FEED_URL>",
"clientId": "<SERVICE_PRINCIPAL_APPLICATION_(CLIENT)_ID>",
"clientCertificateSubjectName": "<SERVICE_PRINCIPAL_CERTIFICATE_NAME>",
"clientCertificateFilePath": "<SERVICE_PRINCIPAL_CERTIFICATE_PATH>"
}
]
}
'@