rembrembdocs

You can use an environment variable here

password = "$NPM_PASSWORD"


* * *

Then assign your Azure Personal Access Token to the `NPM_PASSWORD` environment variable. Bun [automatically reads](../../../runtime/environment-variables/index.md) `.env` files, so create a file called `.env` in your project root. There is no need to base-64 encode this token! Bun will do this for you.

.env

NPM_PASSWORD=<paste token here>


* * *

### 

[​

](#configure-with-environment-variables)

Configure with environment variables

* * *

To configure Azure Artifacts without `bunfig.toml`, you can set the `NPM_CONFIG_REGISTRY` environment variable. The URL should include `:username` and `:_password` as query parameters. Replace `<USERNAME>` and `<PASSWORD>` with the appropriate values.

terminal

NPM_CONFIG_REGISTRY=https://pkgs.dev.azure.com/my-azure-artifacts-user/_packaging/my-azure-artifacts-user/npm/registry/:username=<USERNAME>:_password=<PASSWORD>


* * *

### 

[​

](#don’t-base64-encode-the-password)

Don’t base64 encode the password

* * *

In [Azure Artifact’s](https://learn.microsoft.com/en-us/azure/devops/artifacts/npm/npmrc?view=azure-devops&tabs=windows%2Cclassic) instructions for `.npmrc`, they say to base64 encode the password. Do not do this for `bun install`. Bun will automatically base64 encode the password for you if needed.

**Tip** — If it ends with `==`, it probably is base64 encoded.

* * *

To decode a base64-encoded password, open your browser console and run:

browser

atob("<base64-encoded password>");


* * *

Alternatively, use the `base64` command line tool, but doing so means it may be saved in your terminal history which is not recommended:

terminal

echo "base64-encoded-password" | base64 --decode


Was this page helpful?

[Suggest edits](https://github.com/oven-sh/bun/edit/main/docs/guides/install/azure-artifacts.mdx)[Raise issue](<https://github.com/oven-sh/bun/issues/new?title=Issue on docs&body=Path: /guides/install/azure-artifacts>)

[

Configure a private registry for an organization scope with bun install

Previous

](../registry-scope/index.md)[

Using bun install with Artifactory

Next

](../jfrog-artifactory/index.md)