Skip to content

Commit bfca8ab

Browse files
authored
Merge pull request #290856 from anishtrakru/dtl-managedidentity
Add artifact repo using managed identity or GitHub app authentication
2 parents fd8edda + 6a25176 commit bfca8ab

14 files changed

+191
-13
lines changed

articles/devtest-labs/add-artifact-repository.md

Lines changed: 191 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,80 @@ This article shows you how to add an artifact repository to your lab by using th
2020

2121
[!INCLUDE [updated-for-az](~/reusable-content/ce-skilling/azure/includes/updated-for-az.md)]
2222

23-
## Prerequisites
24-
To add an artifact repository to a lab, you need to know the Git HTTPS clone URL and the personal access token for the GitHub or Azure Repos repository that has the artifact files.
23+
## Add an artifact repo
2524

26-
### Get the clone URL and personal access token for GitHub
25+
You can add an artifact repo from an Azure Repos repository or a GitHub repository. You can choose to authenticate by assigning permissions to a managed identity, by using GitHub app authentication, or by using a PAT.
26+
To learn more about managed identities, see [What are managed identities for Azure resources?](/entra/identity/managed-identities-azure-resources/overview)
2727

28-
1. On the home page of the GitHub repository that has your artifacts, select **Code**, and under **Clone**, copy the HTTPS URL.
29-
1. Select your profile image in the upper-right corner of GitHub, and then select **Settings**.
30-
1. On your profile page, in the left menu, select **Developer Settings**, and then select **Personal access tokens**.
31-
1. Select **Generate new token**.
32-
1. On the **New personal access token** page, under **Note**, enter an optional description for the token. Accept all the defaults, and then select **Generate token**.
33-
1. Save the generated token.
28+
Select the tab for the type of repository and authentication you want to use.
29+
30+
## [Azure Repos repo with MSI](#tab/DevOpsRepoMSI/)
31+
32+
To add an artifact repo, complete the following tasks:
33+
34+
- Assign permissions in Azure Repos for the managed identity.
35+
- Add your artifact repository.
36+
37+
### Assign permissions in Azure Repos for the managed identity
38+
39+
You must give the managed identity permissions to the repository in Azure Repos.
40+
41+
1. Sign in to your [Azure DevOps organization](https://dev.azure.com).
42+
43+
> [!NOTE]
44+
> Your Azure DevOps organization must be in the same directory as the Azure subscription that contains your lab.
45+
46+
1. Select **Organization settings**.
47+
48+
:::image type="content" source="media/devtest-lab-add-repo/devops-organization-settings.png" alt-text="Screenshot showing the Azure DevOps organization page, with Organization Settings highlighted." lightbox="media/devtest-lab-add-repo/devops-organization-settings.png":::
49+
50+
1. On the **Overview** page, select **Users**.
51+
52+
:::image type="content" source="media/devtest-lab-add-repo/devops-organization-overview.png" alt-text="Screenshot showing the Organization overview page, with Users highlighted." lightbox="media/devtest-lab-add-repo/devops-organization-overview.png":::
53+
54+
1. On the **Users** page, select **Add users**.
55+
56+
:::image type="content" source="media/devtest-lab-add-repo/devops-add-user.png" alt-text="Screenshot showing the Users page, with Add user highlighted." lightbox="media/devtest-lab-add-repo/devops-add-user.png":::
57+
58+
1. Complete **Add new users** by entering or selecting the following information, and then select **Add**:
59+
60+
|Name |Value |
61+
|---------|----------|
62+
|**Users or Service Principals**|Enter the name of your lab. <br> When you use a system-assigned MSI, specify the name of the lab, not the object ID of the managed account. When you use a user-assigned MSI, use the name of the managed account. |
63+
|**Access level**|Select **Basic**.|
64+
|**Add to projects**|Select the project that contains your repository.|
65+
|**Azure DevOps Groups**|Select **Project Readers**.|
66+
|**Send email invites (to Users only)**|Clear the checkbox.|
67+
68+
:::image type="content" source="media/devtest-lab-add-repo/devops-add-user-blade.png" alt-text="Screenshot showing Add users, with example entries and Add highlighted." lightbox="media/devtest-lab-add-repo/devops-add-user-blade.png":::
69+
70+
### Add an Azure DevOps artifact repository to a lab in the Azure portal
71+
72+
1. On the lab's **Overview** page, select **Configuration and policies** from the left navigation.
73+
74+
1. On the **Configuration and policies** page, select **Repositories** under **External resources** in the left navigation.
75+
76+
On the **Repositories** page, the **Public Artifact Repo** is automatically present and connects to the [DevTest Labs public GitHub repository](https://github.com/Azure/azure-devtestlab). If this repo isn't enabled for your lab, you can enable it by selecting the checkbox next to **Public Artifact Repo**, and then selecting **Enable** on the top menu bar.
77+
78+
1. To add your artifact repository to the lab, select **Add** in the top menu bar.
79+
80+
![Screenshot that shows the Repositories configuration screen.](media/devtest-lab-add-repo/devtestlab-add-repo.png)
81+
82+
1. In the **Repository** pane, enter the following information:
83+
84+
- **Name**: A repository name to use in the lab.
85+
- **Git clone URL**: The Git HTTPS clone URL from Azure Repos.
86+
- **Branch** (optional): The branch that has your artifact definitions.
87+
- **Folder paths**: The folder for your ARM template definitions, relative to the Git clone URL. Be sure to include the initial forward slash in the folder path.
88+
- **Managed Identity**: Use this option to leverage the Managed Identity for authentication.
89+
90+
1. Select **Save**.
91+
92+
![Screenshot that shows adding a new artifact repository to a lab.](media/devtest-lab-add-repo/devtestlab-repo-blade-with-azure-managed-identity.png)
93+
94+
The repository now appears in the **Repositories** list for the lab.
95+
96+
## [Azure Repos repo with PAT](#tab/DevOpsRepoPAT/)
3497

3598
### Get the clone URL and personal access token for Azure Repos
3699

@@ -40,7 +103,7 @@ To add an artifact repository to a lab, you need to know the Git HTTPS clone URL
40103
1. Fill out the information for the token, selecting **Read** for the scopes, and then select **Create**.
41104
1. On the **Success** page, be sure to copy the token, because Azure Repos doesn't store the token or show it again.
42105

43-
## Add an artifact repository to a lab in the Azure portal
106+
### Add an Azure DevOps artifact repository to a lab in the Azure portal
44107

45108
1. On the lab's **Overview** page, select **Configuration and policies** from the left navigation.
46109

@@ -52,20 +115,135 @@ To add an artifact repository to a lab, you need to know the Git HTTPS clone URL
52115

53116
![Screenshot that shows the Repositories configuration screen.](media/devtest-lab-add-repo/devtestlab-add-repo.png)
54117

118+
1. In the **Repository** pane, enter the following information:
119+
120+
- **Name**: A repository name to use in the lab.
121+
- **Git clone URL**: The Git HTTPS clone URL from Azure Repos.
122+
- **Branch** (optional): The branch that has your artifact definitions.
123+
- **Folder paths**: The folder for your ARM template definitions, relative to the Git clone URL. Be sure to include the initial forward slash in the folder path.
124+
- **Personal access token**: The personal access token from Azure Repos.
125+
126+
1. Select **Save**.
127+
128+
![Screenshot that shows adding a new artifact repository to a lab.](media/devtest-lab-add-repo/devtestlab-repo-blade-with-azure-pat.png)
129+
130+
The repository now appears in the **Repositories** list for the lab.
131+
132+
## [GitHub repo DevCenter app](#tab/GitHubRepoApp/)
133+
134+
To add an artifact repo, complete the following tasks:
135+
136+
1. Install and configure the Microsoft Dev Center app
137+
1. Assign permissions in GitHub for the repos.
138+
1. Add your artifact repository.
139+
140+
### Install Microsoft Dev Center app
141+
142+
1. Sign in to the [Azure portal](https://portal.azure.com).
143+
144+
1. Navigate to your lab.
145+
146+
1. On the lab's **Overview** page, select **Configuration and policies** from the left navigation.
147+
148+
1. On the **Configuration and policies** page, select **Repositories** under **External resources** in the left navigation.
149+
150+
1. Select **Add** in the top menu bar.
151+
55152
1. In the **Repository** pane, enter the following information:
56153

57154
- **Name**: A repository name to use in the lab.
58155
- **Git clone URL**: The Git HTTPS clone URL from GitHub or Azure Repos.
156+
157+
1. To install the Microsoft Dev Center app, select **Microsoft DevCenter GitHub app**.
158+
159+
:::image type="content" source="media/devtest-lab-add-repo/devtestlab-repo-select-github-app.png" alt-text="Screenshot showing Microsoft DevCenter GitHub app option on Add a repo page, with example entries and install link highlighted." lightbox="media/devtest-lab-add-repo/devtestlab-repo-select-github-app.png":::
160+
161+
1. If you're prompted to authenticate to GitHub, authenticate.
162+
163+
1. On the **Microsoft DevCenter** page, select **Install**.
164+
165+
:::image type="content" source="media/devtest-lab-add-repo/devtestlab-install-github-app.png" alt-text="Screenshot showing Microsoft DevCenter GitHub app installation page." lightbox="media/devtest-lab-add-repo/devtestlab-install-github-app.png":::
166+
167+
1. Select the GitHub organization that contains the artifact repository you want to add to the lab. You must be an owner of the organization to install this app.
168+
169+
:::image type="content" source="media/devtest-lab-add-repo/devtestlab-install-github-app-select-organization.png" alt-text="Screenshot of the Install Microsoft DevCenter page, with a GitHub organization highlighted." lightbox="media/devtest-lab-add-repo/devtestlab-install-github-app-select-organization.png":::
170+
171+
1. On the Install Microsoft DevCenter page, select **Only select repositories**, select the repository you want to add to the lab, and then select **Install**.
172+
173+
:::image type="content" source="media/devtest-lab-add-repo/devtestlab-select-one-repository.png" alt-text="Screenshot of the Install Microsoft DevCenter page, with one repository selected and highlighted." lightbox="media/devtest-lab-add-repo/devtestlab-select-one-repository.png":::
174+
175+
You can select multiple repositories to add to the lab. You must add each repository separately to the lab, as described in this article.
176+
177+
1. On the **Microsoft DevCenter by Microsoft would like permission to:** page, review the permissions required, and then select **Authorize Microsoft Dev Center**.
178+
179+
:::image type="content" source="media/devtest-lab-add-repo/devtestlab-authorize-microsoft-dev-center.png" alt-text="Screenshot of the Microsoft DevCenter by Microsoft would like permission to page, with authorize highlighted." lightbox="media/devtest-lab-add-repo/devtestlab-authorize-microsoft-dev-center.png":::
180+
181+
### Add an GitHub artifact repository to a lab in the Azure portal
182+
183+
1. On the lab's **Overview** page, select **Configuration and policies** from the left navigation.
184+
185+
1. On the **Configuration and policies** page, select **Repositories** under **External resources** in the left navigation.
186+
187+
On the **Repositories** page, the **Public Artifact Repo** is automatically present and connects to the [DevTest Labs public GitHub repository](https://github.com/Azure/azure-devtestlab). If this repo isn't enabled for your lab, you can enable it by selecting the checkbox next to **Public Artifact Repo**, and then selecting **Enable** on the top menu bar.
188+
189+
1. To add your artifact repository to the lab, select **Add** in the top menu bar.
190+
191+
![Screenshot that shows the Repositories configuration screen.](media/devtest-lab-add-repo/devtestlab-add-repo.png)
192+
193+
1. In the **Repository** pane, enter the following information:
194+
195+
- **Name**: A repository name to use in the lab.
196+
- **Git clone URL**: The Git HTTPS clone URL from GitHub Repos.
197+
- **Branch** (optional): The branch that has your artifact definitions.
198+
- **Folder paths**: The folder for your ARM template definitions, relative to the Git clone URL. Be sure to include the initial forward slash in the folder path.
199+
- **GitHub app**: Use this option to leverage GitHub app authentication.
200+
201+
1. Select **Save**.
202+
203+
![Screenshot that shows adding a new artifact repository to a lab.](media/devtest-lab-add-repo/devtestlab-repo-blade-with-github-app-auth.png)
204+
205+
The repository now appears in the **Repositories** list for the lab.
206+
207+
## [GitHub repo with PAT](#tab/GitHubRepoPAT/)
208+
209+
### Get the clone URL and personal access token for GitHub
210+
211+
1. On the home page of the GitHub repository that has your artifacts, select **Code**, and under **Clone**, copy the HTTPS URL.
212+
1. Select your profile image in the upper-right corner of GitHub, and then select **Settings**.
213+
1. On your profile page, in the left menu, select **Developer Settings**, and then select **Personal access tokens**.
214+
1. Select **Generate new token**.
215+
1. On the **New personal access token** page, under **Note**, enter an optional description for the token. Accept all the defaults, and then select **Generate token**.
216+
1. Save the generated token.
217+
218+
### Add a GitHub artifact repository to a lab in the Azure portal
219+
220+
1. On the lab's **Overview** page, select **Configuration and policies** from the left navigation.
221+
222+
1. On the **Configuration and policies** page, select **Repositories** under **External resources** in the left navigation.
223+
224+
On the **Repositories** page, the **Public Artifact Repo** is automatically present and connects to the [DevTest Labs public GitHub repository](https://github.com/Azure/azure-devtestlab). If this repo isn't enabled for your lab, you can enable it by selecting the checkbox next to **Public Artifact Repo**, and then selecting **Enable** on the top menu bar.
225+
226+
1. To add your artifact repository to the lab, select **Add** in the top menu bar.
227+
228+
![Screenshot that shows the Repositories configuration screen.](media/devtest-lab-add-repo/devtestlab-add-repo.png)
229+
230+
1. In the **Repository** pane, enter the following information:
231+
232+
- **Name**: A repository name to use in the lab.
233+
- **Git clone URL**: The Git HTTPS clone URL from GitHub Repos.
59234
- **Branch** (optional): The branch that has your artifact definitions.
60-
- **Personal access token**: The personal access token from GitHub or Azure Repos.
61235
- **Folder paths**: The folder for your ARM template definitions, relative to the Git clone URL. Be sure to include the initial forward slash in the folder path.
236+
- **Personal access token**: The personal access token from GitHub Repos.
237+
62238

63239
1. Select **Save**.
64240

65-
![Screenshot that shows adding a new artifact repository to a lab.](media/devtest-lab-add-repo/devtestlab-repo-blade.png)
241+
![Screenshot that shows adding a new artifact repository to a lab.](media/devtest-lab-add-repo/devtestlab-repo-blade-with-github-pat.png)
66242

67243
The repository now appears in the **Repositories** list for the lab.
68244

245+
---
246+
69247
## Add an artifact repository by using an ARM template
70248

71249
ARM templates are JSON files that describe Azure resources to create. For more information about ARM templates, see [Understand the structure and syntax of ARM templates](../azure-resource-manager/templates/syntax.md).
@@ -323,7 +501,7 @@ The PowerShell script takes the following parameters:
323501
| `LabName` | The name of the lab. |
324502
| `ArtifactRepositoryName` | Name for the new artifact repository. The script creates a random name for the repository if it isn't specified. |
325503
| `ArtifactRepositoryDisplayName` | Display name that appears in the lab's artifact repository list. |
326-
| `RepositoryUri` | URI of the artifact repository, which you copied earlier.
504+
| `RepositoryUri` | URI of the artifact repository, which you copied earlier.|
327505
| `RepositoryBranch` | Repository branch that contains the artifacts. The default value is `main`.|
328506
| `FolderPath` | Folder that contains the artifacts. The default value is: `/Artifacts`.|
329507
| `PersonalAccessToken` | Security token for accessing the repository, which you copied earlier.|
26 KB
Loading
104 KB
Loading
59.5 KB
Loading
32.9 KB
Loading
44.7 KB
Loading
20.4 KB
Loading
93.8 KB
Loading
98.9 KB
Loading
77.5 KB
Loading

0 commit comments

Comments
 (0)