The Azure Artifacts Credential Provider enables dotnet, NuGet.exe, and MSBuild to interactively acquire credentials for Azure Artifacts feeds.
The Azure Artifacts Credential Provider enables dotnet, NuGet.exe, and MSBuild to interactively acquire credentials for Azure Artifacts feeds.
The Azure Artifacts Credential Provider automates the acquisition of credentials for your Azure Artifacts feed. It is most commonly used as a component in package manager tools, such as credential providers for dotnet, npm, Maven, pip, and others. Used directly, it integrates with MSBuild and NuGet(.exe). Windows, Mac, and Linux are all supported.
Any time you want to restore or install packages from an Azure Artifacts feed, the Credential Provider will automatically acquire and securely store a token on behalf of the NuGet client you're using.
If using one of the credential provider tools for other package management ecosystems (Maven, pip, etc.), follow the guidance for that tool. A separate installation of the Azure Artifacts Credential Provider may not required.
dotnetdotnet tool installation requires the .NET SDK version 9.0.200 or later. You can read about dotnet tool in its public documentation. If you use Visual Studio, .NET 9 may already be included. Users of Visual Studio Code may already have it installed via the C# Dev Kit extensions.
If you need to use .NET 8, use the plugin method described for NuGet below.
Install Visual Studio version 15.9-preview1 or later to get the required version of MSBuild (15.8.166.59604 or later). Alternatively, you can download MSBuild directly by downloading the Build Tools for Visual Studio. MSBuild is also installed as a part of the .NET Core SDK.
nuget.exe on the command line version 4.8.0.5385 or later is required. The recommended NuGet version is 5.5.x or later as it has some important bug fixes related to cancellations and timeouts.
Self-contained .NET applications on Linux may require additional native dependencies such as libicu and libssl. See .NET 8 Linux packages and Self-contained Linux applications for the full list of dependencies.
dotnetUse the tool installer included with dotnet to acquire and install the credential provider specific to dotnet, regardless of operating system.
dotnet tool install --global Microsoft.Artifacts.CredentialProvider.NuGet.ToolIf your project is already configured through a nuget.config to use an Azure Artifacts feed exclusively, you may need to run the command from a folder outside of your project. Alternatively, you can specify nuget.org as the source:
dotnet tool install --global Microsoft.Artifacts.CredentialProvider.NuGet.Tool --source https://api.nuget.org/v3/index.jsonOptionally, use the --version parameter to pin to a major version, especially when installing on containers:
dotnet tool install --global Microsoft.Artifacts.CredentialProvider.NuGet.Tool --version 2.* --source https://api.nuget.org/v3/index.jsonMost users will not require further install steps. Some containers or manual dotnet install scenarios require adding the dotnet tools directory to your PATH
(e.g., ENV PATH="$PATH:/root/.dotnet/tools"). See samples/dockerfile.sample for an example.
If you are using nuget.exe, you can use the Azure Artifacts Credential Provider by adding it to NuGet's plugin search path. This section contains both manual and scripted instructions for doing so. If necessary, the plugin method also works for dotnet.
dotnet needs the netcore version to be installed. NuGet and MSBuild need the netfx version to be installed.
Once the plugin has been added, follow the OS-specific installation instructions below.
The PowerShell helper scripts require PowerShell 5.1 or later.
installcredprovider.ps1iex "& { $(irm https://aka.ms/install-artifacts-credprovider.ps1) }"iex "& { $(irm https://aka.ms/install-artifacts-credprovider.ps1) } -InstallNet6"iex "& { $(irm https://aka.ms/install-artifacts-credprovider.ps1) } -InstallNet8"installcredprovider.ps1 -AddNetfx. The netfx version is needed for nuget.exe.iex "& { $(irm https://aka.ms/install-artifacts-credprovider.ps1) } -AddNetfx"-AddNetFx48 flagnetcore (and netfx for nuget.exe) directory from the extracted archive to $env:UserProfile\.nuget\plugins (%UserProfile%/.nuget/plugins/)Using the above is recommended, but as per NuGet's plugin discovery rules, alternatively you can install the credential provider to a location you prefer, and then set the environment variable NUGET_PLUGIN_PATHS to the .exe of the credential provider found in plugins\netfx\CredentialProvider.Microsoft\CredentialProvider.Microsoft.exe. For example, $env:NUGET_PLUGIN_PATHS="my-alternative-location\CredentialProvider.Microsoft.exe". Note that if you are using both nuget.exe and dotnet, this environment variable is not recommended due to this issue: https://github.com/NuGet/Home/issues/8151
Examples:
wget -qO- https://aka.ms/install-artifacts-credprovider.sh | bashsh -c "$(curl -fsSL https://aka.ms/install-artifacts-credprovider.sh)"Note: this script only installs the netcore version of the plugin. If you need to have it working with mono MSBuild, you will need to download the version with both netcore and netfx binaries following the steps in Manual installation on Linux and Mac
Note: The scripts install the latest, self-contained versions by default. For installs on Linux, see prerequisites for Linux self-contained installs for additional dependencies or use the
ARTIFACTS_CREDENTIAL_PROVIDER_NON_SCvariable to use the non-self-contained version that requires the .NET runtime.
netcore (and netfx for msbuild /t:restore) directory from the extracted archive to $HOME/.nuget/pluginsUsing the above is recommended, but as per NuGet's plugin discovery rules, alternatively you can install the credential provider to a location you prefer, and then set the environment variable NUGET_PLUGIN_PATHS to the .dll of the credential provider found in plugins\netcore\CredentialProvider.Microsoft\CredentialProvider.Microsoft.dll. For example, $env:NUGET_PLUGIN_PATHS="my-alternative-location\CredentialProvider.Microsoft.dll".
Users requiring .NET 6, such as ARM64 users, can manually download the .NET 6 version Microsoft.Net6.NuGet.CredentialProvider of the 1.0.0 release. Support for .NET 8 was added in release 1.3.0 and can be downloaded with the Microsoft.Net8.NuGet.CredentialProvider archive for runtime-dependent installs, or RID-specific archives (e.g., Microsoft.win-x64.NuGet.CredentialProvider) for self-contained installs (v2.0.0+).
The Azure Artifacts Credential Provider is most commonly used indirectly, either through a credential provider specific to a package management ecosystem or by performing a NuGet operation that requires authentication such as dotnet, nuget.exe, or MSBuild.
dotnetThe first time you perform an operation that requires authentication using dotnet, you should either use the --interactive flag to allow dotnet to prompt you for credentials, or provide them via an environment variable.
If interactive authorization is available, navigate to your project directory and run:
dotnet restore --interactiveOnce you've successfully acquired a token, you can run authenticated commands without the --interactive flag for the lifespan of the token, saved in the session token cache location.
The nuget.exe client will prompt for authentication when you run a restore and it does not find credentials in the session token cache location. By default, it will attempt to open a dialog for authentication and will fall back to console input if that fails.
nuget restoreWhen using Windows and you are already signed in to Azure DevOps, Windows Integrated Authentication may be used to get automatically authenticated as the signed in user.
The first time you perform an operation that requires authentication using MSBuild, you must use the /p:nugetInteractive=true switch to allow MSBuild to prompt you for credentials. For example, to restore packages, navigate to your project or solution directory and run:
msbuild /t:restore /p:nugetInteractive=trueOnce you've successfully acquired a token, you can run authenticated commands without the /p:nugetInteractive=true switch.
Use the NuGetAuthenticate task before running NuGet, dotnet or MSBuild commands that need authentication.
If you're running the command as part of an automated build on an unattended build agent outside of Azure DevOps Pipelines, you can supply an access token directly using the ARTIFACTS_CREDENTIALPROVIDER_EXTERNAL_FEED_ENDPOINTS environment variable. The use of Personal Access Tokens is recommended f
No open issues yet, or sync has not completed.