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
Copy file name to clipboardExpand all lines: docs/artifacts/tutorials/protect-oss-packages-with-upstream-sources.md
+60-58Lines changed: 60 additions & 58 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,90 +23,66 @@ This tutorial walks you through enabling upstream sources in your feed and consu
23
23
24
24
## Create a feed and enable upstream sources
25
25
26
-
::: moniker range="<=azure-devops"
27
-
28
26
1. Sign in to your Azure DevOps organization, and then navigate to your project.
29
27
30
28
1. Select **Artifacts**, and then select **Create Feed** to create a new feed.
31
29
32
-
:::image type="content" source="../media/new-feed-button-azure-devops-newnav.png" alt-text="Screenshot showing the create feed button.":::
33
-
34
-
1. Provide a name for your feed, and choose its visibility. Make sure you check the **Include packages from common public sources** checkbox to enable upstream sources, and then select **Create** when you're done.
30
+
1. Provide a **Name** for your feed, choose its **Visibility** and **Scop**, and make sure you check the **Include packages from common public sources** checkbox to enable upstream sources.
35
31
36
-
:::image type="content" source="../media/new-feed-dialog.png" alt-text="Screenshot showing the create a new feed window.":::
32
+
1. Select **Create** when you're done.
37
33
38
-
::: moniker-end
34
+
:::image type="content" source="../media/new-feed-with-upstream-source.png" alt-text="a Screenshot displaying how to create a new feed and enable upstream sources in Azure Artifacts.":::
39
35
40
-
> [!NOTE]
36
+
> [!IMPORTANT]
41
37
> To add a feed from a different organization as an upstream source, the target feed owner must share the target view with **All feeds and people in organizations associated with my Microsoft Entra tenant** by navigating to **Feed Settings** > **Views** > Select the ellipsis button on the right for the specified view > **Edit** .
42
38
43
-
## Set up the configuration file
39
+
## Authenticate with the feed
44
40
45
-
Now that we created our feed, we need to update the config file to point to our feed. To do this we must:
46
-
47
-
1. Get the source's URL
48
-
1. Update the configuration file
41
+
Now that you've created your feed, select the appropriata tab based on the technology you're using and follow the instructions to set up your configuration file and connect to your feed:
49
42
50
43
#### [npm](#tab/npm/)
51
44
52
-
::: moniker range="<=azure-devops"
53
-
54
-
1. Select **Artifacts**, and then select **Connect to feed**.
55
-
56
-
:::image type="content" source="../media/connect-to-feed-azure-devops-newnav.png" alt-text="Screenshot showing how to connect to a feed.":::
57
-
58
-
1. On the left side of the page, select the **npm** tab.
59
-
60
-
1. Follow the instructions in the **Project setup** section to set up your config file.
45
+
1. Sign in to your Azure DevOps organization, and then navigate to your project.
61
46
62
-
:::image type="content" source="../media/connect-to-feed-npm-registry-azure-devops-newnav.png" alt-text="Screenshot showing how to set up your project.":::
47
+
1. Select **Artifacts**, select your feed from the dropdown menu, and then select **Connect to feed**.
63
48
64
-
::: moniker-end
49
+
1. Select **npm** from the left navigation pane, and follow the provided instructions in the **Project setup** section to set up your config file. If you don’t already have a *.npmrc* file, create a new one in the root of your project (the same folder as your *package.json*). Open your new *.npmrc* file and paste in the provided snippet.
65
50
66
-
If you don't have a *.npmrc* file already, create a new one in the root of your project (in the same folder as your *package.json*). Open your new *.npmrc* file and paste the snippet you just copied in the previous step.
51
+
:::image type="content" source="../media/connect-to-feed-npm-registry-azure-devops-newnav.png" alt-text="A screenshot displaying how to set up your npm project in Azure Artifacts.":::
67
52
68
53
#### [NuGet](#tab/nuget/)
69
54
70
-
1. Select **Artifacts**, and then select your feed.
71
-
72
-
1. Select **Connect to feed**, and then choose **NuGet.exe**.
73
-
74
-
:::image type="content" source="../media/nuget-connect-to-feed.png" alt-text="Screenshot showing how to connect to NuGet feeds.":::
55
+
1. Sign in to your Azure DevOps organization, and then navigate to your project.
75
56
76
-
1.Copy the XML snippet in the **Project Setup** section.
57
+
1.Select **Artifacts**, select your feed from the dropdown menu, and then select **Connect to feed**.
77
58
78
-
1.Create a new file named *nuget.config* in the root of your project.
59
+
1.Select **NuGet.exe** from the left navigation pane, then copy the XML snippet provided in the **Project Setup** section.
79
60
80
-
1.Paste the XML snippet in your config file.
61
+
1.Create a new *nuget.config* file in the root of your project, and paste in the XML snippet you copied in the previous step.
81
62
82
63
#### [Pip](#tab/pip/)
83
64
84
-
1.Select **Artifacts**, and then select your feed from the dropdown list.
65
+
1.Sign in to your Azure DevOps organization, and then navigate to your project.
85
66
86
-
1. Select **Connect to feed**, and then select **pip** under the Python section.
67
+
1. Select **Artifacts**, select your feed from the dropdown menu,and then select **Connect to feed**.
87
68
88
-
:::image type="content" source="../media/project-setup-pip.png" alt-text="A screenshot showing how to connect to a feed with pip projects.":::
69
+
1. Select **pip** from the left navigation pane.
89
70
90
71
1. Create a [virtual environment](https://go.microsoft.com/fwlink/?linkid=2103878) if you haven't done so already.
91
72
92
-
1. Add a pip.ini (Windows) or pip.conf (Mac/Linux) file to your virtualenv and paste the following snippet:
1. Add a *pip.ini* (Windows) or *pip.conf* (Mac/Linux) file to your virtualenv and paste in the snippet provided in the **Project setup** secion.
98
74
99
75
#### [Maven](#tab/maven/)
100
76
101
-
1. Select **Artifacts**, and thenselectyour feed from the dropdown list.
77
+
1.Sign in to your Azure DevOps organization, and then navigate to your project.
102
78
103
-
1. Select **Connect to feed**, and thenselect**Maven**.
79
+
1. Select **Artifacts**, select your feed from the dropdown menu, and then select **Connect to feed**.
104
80
105
-
:::image type="content" source="../media/project-setup-maven.png" alt-text="A screenshot showing how to connect to a feed with Maven projects.":::
81
+
1. Select **Maven** from the left navigation pane.
106
82
107
-
1. Add the following snippet to the `<repositories>` and `<distributionManagement>` sections in your pom.xml:
83
+
1. Add the snippet provided in the **Project setup** section to the `<repositories>` and `<distributionManagement>` sections in your *pom.xml*. Your file should look similar to the following:
@@ -136,19 +112,19 @@ If you don't have a *.npmrc* file already, create a new one in the root of your
136
112
</settings>
137
113
```
138
114
139
-
1. Create a [personal access token](../../organizations/accounts/use-personal-access-tokens-to-authenticate.md#create-a-pat) with **Packaging**>**Read & write** scopes and paste your personal access token into the `<password>` tag in your settings.xml file.
115
+
1. Create a [personal access token](../../organizations/accounts/use-personal-access-tokens-to-authenticate.md#create-a-pat) with **Packaging** > **Read & write** scopes and paste your personal access token into the `<password>` tag in your *settings.xml* file.
140
116
141
117
#### [Gradle](#tab/gradle/)
142
118
143
-
1. Select **Artifacts**, and thenselectyour feed from the dropdown list.
119
+
1. Sign in to your Azure DevOps organization, and then navigate to your project.
144
120
145
-
1. Select **Connect to feed**, and thenselect**Gradle**.
121
+
1. Select **Artifacts**, select your feed from the dropdown menu, and then select **Connect to feed**.
146
122
147
-
:::image type="content" source="../media/project-setup-gradle.png" alt-text="A screenshot showing how to connect to a feed with Gradle projects.":::
123
+
1. Select **Gradle** from the left navigation pane.
148
124
149
-
1. Add the following snippet to the *repositories* and *publishing* sections in your build.gradle file:
125
+
1. Add the snippet provided in the **Project setup** section to the *repositories* and *publishing* sections in your *build.gradle* file. Your file should resemble the following:
@@ -175,7 +151,33 @@ If you don't have a *.npmrc* file already, create a new one in the root of your
175
151
</settings>
176
152
```
177
153
178
-
1. Create a [personal access token](../../organizations/accounts/use-personal-access-tokens-to-authenticate.md#create-a-pat) with **Packaging**>**Read & write** scopes. Paste your personal access token into the `<password>` tag in your settings.xml file.
154
+
1. Create a [personal access token](../../organizations/accounts/use-personal-access-tokens-to-authenticate.md#create-a-pat) with **Packaging** > **Read & write** scopes. Paste your personal access token into the `<password>` tag in your *settings.xml* file.
155
+
156
+
#### [Cargo](#tab/cargo/)
157
+
158
+
1. Sign in to your Azure DevOps organization, and navigate to your project.
159
+
160
+
1. Select **Artifacts**, select your feed from the dropdown menu, and then select **Connect to feed**.
161
+
162
+
1. Select **Cargo** from the left navigation pane.
163
+
164
+
1. Add the snippet provided in the **Project setup** section to your *cargo/config.toml* file in your source repository. Your *config.toml* file should resemble the following:
165
+
166
+
```
167
+
[registries]
168
+
FEED_NAME = { index = "sparse+https://pkgs.dev.azure.com/ORGANIZATION_NAME/PROJECT_NAME/_packaging/FEED_NAME/Cargo/index/" }
169
+
```
170
+
171
+
1. Add the second snippet provided in the **Project setup** section to your *cargo/config.toml* file to replace the *crates.io* source with your feed. Your file should resemble the following:
172
+
173
+
```
174
+
[source.crates-io]
175
+
replace-with = "FEED_NAME"
176
+
```
177
+
178
+
1. [Configure a credential provider](../cargo/project-setup-cargo.md#configure-a-credential-provider)
179
+
180
+
1. [Log in to the registry](../cargo/project-setup-cargo.md#log-in-to-the-registry)
0 commit comments