You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Azure Artifacts enables developers to manage their packages from various sources, including both public registries like npmjs.com and private feeds. To authenticate with Azure Artifacts, you'll need to configure your npm config file. This file contains feed URLs and credentials used by npm, offering options to customize your npm client behavior, such as setting up proxies, defining default package locations, or configuring private package feeds. The *npmrc* file is typically located in the user's home directory but can also be created at the project level to override default settings.
17
+
Azure Artifacts enables developers to manage packages from various sources, including public registries like *npmjs.com* and private feeds. To authenticate with Azure Artifacts, you need to configure your *.npmrc* config file. This file stores feed URLs and credentials used by npm, and it allows you to customize client behavior such as setting up proxies, defining default package locations, or configuring access to private feeds. The *.npmrc* file is typically located in the user's home directory, but can also be created at the project level to override default settings.
18
18
19
19
## Prerequisites
20
20
21
-
- An Azure DevOps organization. [Create one for free](../../organizations/accounts/create-organization.md).
21
+
|**Product**|**Requirements**|
22
+
|--------------------|--------------------|
23
+
|**Azure DevOps**| - An Azure DevOps [organization](../../organizations/accounts/create-organization.md).<br>- An Azure DevOps [project](../../organizations/projects/create-project.md).<br>- An Azure Artifacts [feed](../get-started-npm.md#create-a-feed)<br> - [Download and install Node.js and npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm).|
22
24
23
-
- An Azure DevOps project. Create a new [project](../../organizations/projects/create-project.md#create-a-project) if you don't have one already.
25
+
## Connect to a feed
24
26
25
-
- An Azure Artifacts feed. [Create one for free](../get-started-npm.md#create-a-feed).
27
+
Azure Artifacts recommends using two separate *.npmrc* configuration files. One should be stored locally to store your credentials, while the other should be added to your project directory alongside your *package.json* to define your feed URL. This approach allows you to share your project-level configuration without exposing sensitive information.
26
28
27
-
-[Download and install Node.js and npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm).
29
+
To set up the credentials file, create or update the *.npmrc* file and include all necessary registry credentials. This enables the npm client to easily access your credentials for authentication.
28
30
29
-
## Connect to Feed
30
-
31
-
Azure Artifacts recommends using two separate configuration files. The first is dedicated to authenticating with Azure Artifacts, while the second should be kept locally to store your credentials. This approach allows you to share your configuration file while keeping your credentials secure.
32
-
33
-
To set up the second file, place it in your home directory on your development machine and include all your registry credentials. This enables the npm client to easily access your credentials for authentication.
34
-
35
-
The following steps guide you through setting up the first configuration file. Select the tab that corresponds to your development environment:
31
+
The following steps guide you through setting up the project-level configuration file. Select the tab that corresponds to your development environment:
36
32
37
33
::: moniker range="< azure-devops"
38
34
@@ -47,17 +43,21 @@ The following steps guide you through setting up the first configuration file. S
47
43
48
44
1. Sign in to your Azure DevOps organization, and then navigate to your project.
49
45
50
-
1. Select **Artifacts**, and then select **Connect to Feed**.
51
-
52
-
:::image type="content" source="../media/npm-connect-to-feed-azure-devops.png" alt-text="A screenshot showing how to connect to a feed in Azure DevOps Services.":::
46
+
1. Select **Artifacts**, and then select your feed from the dropdown menu.
53
47
54
-
1. Select **npm**from the left sidebar. If this is the first time using Azure Artifacts with npm, make sure you've installed the prerequisites.
48
+
1. Select **Connect to Feed**and then select **npm** from the left navigation pane.
55
49
56
-
1.Follow the instructions in the **Project setup**section to connect to your feed.
50
+
1.Add a *.npmrc* to your project, in the same directory as your *package.json* and paste the provided snippet from the **Project setup**into the file.
57
51
58
-
:::image type="content" source="../media/npm-project-setup-azure-devops.png" alt-text="A screenshot showing how to set up your npm project.":::
52
+
:::image type="content" source="../media/npm-project-setup-azure-devops.png" alt-text="A screenshot displaying how to set up your npm project and connect to a feed.":::
59
53
60
-
### [Linux/macOS](#tab/Linuxmac/)
54
+
1. Run the following command to get an Azure Artifacts token added to your user-level *.npmrc* file. You don’t need to run this every time—npm will return a **401 Unauthorized** error when it’s time to refresh the token.
55
+
56
+
```
57
+
vsts-npm-auth -config .npmrc
58
+
```
59
+
60
+
### [Other](#tab/other/)
61
61
62
62
1. Add a *.npmrc* file in your project's directory, in the same directory as your *package.json* file, and paste the following snippet into it.
0 commit comments