The best VSTS NPM Auth tool
npm install best-vsts-npm-authRefresh Azure DevOps Artifacts (ADO) npm authentication on your machine.
- Reads your project .npmrc (and any scoped registries).
- Gets an ADO access token via Azure CLI (no app registration required).
- Writes short-lived tokens to your user ~/.npmrc (and optionally project .yarnrc.yml).
---
- Node.js + npm
- Azure CLI installed and logged in:
``bash`
az login
If your org requires a specific tenant, set AZURE_TENANT_ID:
`bash`
export AZURE_TENANT_ID="
---
`bash`
npm i -g best-vsts-npm-auth
1. Download best-vsts-npm-auth- from your Releases page.
2. Install it globally:
`bash`
npm i -g /path/to/best-vsts-npm-auth-
---
Process the local project .npmrc:
`bash`
best-vsts-npm-auth .
Process a specific .npmrc:
`bash`
best-vsts-npm-auth -n /path/to/.npmrc
Also update Yarn Berry config:
`bash`
best-vsts-npm-auth -y ./.yarnrc.yml .
---
- ADO access tokens are typically valid for ~1 hour. Re-run the tool (or mint a new token) if you see 401.~/.npmrc
- Tokens are written only to the user (not your project .npmrc`) unless you intentionally configure otherwise.