Azure
Artifacts’
instructions for
.npmrc say to base64 encode the password. Do not do this in bunfig.toml or NPM_CONFIG_REGISTRY
as shown below; Bun base64 encodes the password for you. Bun also reads .npmrc files, and there
_password must stay base64 encoded, as in Azure’s instructions.Configure with bunfig.toml
To use it with
bun install, add a bunfig.toml file to your project with the following contents. Replace my-azure-devops-org with the name of your Azure DevOps organization and my-feed with the name of your feed. If the feed is project-scoped, the URL also includes the project name: https://pkgs.dev.azure.com/my-azure-devops-org/my-project/_packaging/my-feed/npm/registry/. The username can be any non-empty string.
bunfig.toml
Then assign your Azure Personal Access Token to the
NPM_PASSWORD environment variable. Bun automatically reads .env files, so create a file called .env in your project root. Don’t base64 encode the token; Bun does that for you.
.env
Configure with environment variables
To configure Azure Artifacts without
bunfig.toml, set the NPM_CONFIG_REGISTRY environment variable. The URL should have :username=<USERNAME> and :_password=<PASSWORD> appended to it, as shown below. Replace <USERNAME> and <PASSWORD> with your own values.
terminal
Don’t base64 encode the password
Azure Artifacts’ instructions for
.npmrc say to base64 encode the password. Do not do this in bunfig.toml or NPM_CONFIG_REGISTRY; Bun base64 encodes the password for you. Bun also reads .npmrc files, and there _password must stay base64 encoded, as in Azure’s instructions.
Azure DevOps personal access tokens are 84 characters long. A base64-encoded one is 112 characters long and does not
end with
=.To decode a base64-encoded password, open your browser console and run:
browser
Alternatively, use the
base64 command line tool, though the password may end up in your shell history:
terminal