Azure Artifacts npm Authentication Helper (Windows Only)

0.43.0 · deprecated · verified Wed Apr 22

`vsts-npm-auth` is a command-line tool designed to assist Windows users in authenticating with private npm feeds hosted in Azure Artifacts. Its primary function is to acquire and manage authentication tokens, writing them to the user's `.npmrc` file to enable seamless package installation and publication to Azure DevOps feeds. The package's current stable version is 0.43.0, last published in May 2023. This tool is notably Windows-only and has critical limitations regarding cross-platform support and token management. Community consensus and various reports strongly advise against its use due to its closed-source nature, lack of transparency regarding contributors, and security concerns. Newer, cross-platform alternatives like `ado-npm-auth` or `azure-devops-npm-auth`, along with direct Personal Access Token (PAT) configuration, are generally recommended for more robust and secure authentication with Azure Artifacts. The official documentation also outlines manual PAT setup for non-Windows environments.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates the installation of `vsts-npm-auth` globally on Windows, configuring a project-level `.npmrc` file, and running the authentication helper to enable `npm install` from an Azure Artifacts private feed.

# 1. Install the tool globally (Windows only)
npm install -g vsts-npm-auth --registry https://registry.npmjs.com --always-auth false

# 2. Navigate to your project directory
cd my-azure-devops-project

# 3. Create a .npmrc file in your project root with your feed URL
#    (Replace <your-organization> and <your-feed-name>)
#    Example: @my-scope:registry=https://pkgs.dev.azure.com/<your-organization>/_packaging/<your-feed-name>/npm/registry/
#    You can get the exact content from Azure Artifacts 'Connect to feed' instructions.

echo "@my-scope:registry=https://pkgs.dev.azure.com/myorg/_packaging/myfeed/npm/registry/" > .npmrc

# 4. Run the auth helper to acquire and store credentials.
#    The -F (force) flag ensures tokens are always refreshed if needed.
vsts-npm-auth -config .npmrc -F

# 5. Now you can install packages from your private feed
npm install @my-scope/my-package

view raw JSON →