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: articles/devtest-labs/add-artifact-repository.md
+19-22Lines changed: 19 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -6,35 +6,35 @@ ms.date: 01/04/2022
6
6
ms.custom: devx-track-azurepowershell
7
7
---
8
8
9
-
# Add an artifact repository to your lab in DevTest Labs
9
+
# Add an artifact repository to a lab
10
10
11
11
You can add *artifacts* to Azure DevTest Labs virtual machines (VMs). Artifacts are tools or applications to install on the VM. You define artifacts in a JSON file that you load from a GitHub or Azure Repos Git repository.
12
12
13
13
The public [DevTest Labs GitHub artifact repository](https://github.com/Azure/azure-devtestlab/tree/master/Artifacts) provides many common artifacts for Windows and Linux. The artifacts in this repository are available by default in DevTest Labs. You can also create custom artifacts that aren't available in the public artifact repository. To learn about creating custom artifacts, see [Create custom artifacts](devtest-lab-artifact-author.md).
14
14
15
-
Add your custom artifacts to your own artifact repository, and add the repository to your lab so all lab users can access the artifacts. This article tells you how to add an artifact repository to your lab by using the Azure portal, an Azure Resource Management (ARM) template, or Azure PowerShell. You can also use Azure PowerShell or Azure CLI scripts to automate adding an artifact repository to a lab.
15
+
You can add your custom artifacts to your own artifact repository, and add the repository to your lab so all lab users can access the artifacts. This article tells you how to add an artifact repository to your lab by using the Azure portal, an Azure Resource Management (ARM) template, or Azure PowerShell. You can also use Azure PowerShell or Azure CLI scripts to automate adding an artifact repository to a lab.
To add a repository to your lab, you need the Git HTTPS clone URL and the personal access token for the GitHub or Azure Repos repository that has your artifact files.
20
+
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.
21
21
22
-
### Clone URL and personal access token for GitHub
22
+
### Get the clone URL and personal access token for GitHub
23
23
24
24
1. On the home page of the GitHub repository that has your artifacts, select **Code**, and under **Clone**, copy the HTTPS URL.
25
25
1. Select your profile image in the upper-right corner of GitHub, and then select **Settings**.
26
26
1. On your profile page, in the left menu, select **Developer Settings**, and then select **Personal access tokens**.
27
27
1. Select **Generate new token**.
28
-
1. On the **New personal access token** page, under **Note**, enter a description. Accept all the defaults, and then select **Generate token**.
28
+
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**.
29
29
1. Save the generated token.
30
30
31
-
### Clone URL and personal access token for Azure Repos
31
+
### Get the clone URL and personal access token for Azure Repos
32
32
33
33
1. On the main page of the repository that has your artifacts, select **Clone**. On the **Clone Repository** page, copy the clone URL.
34
34
1. In the upper-right corner of the Azure DevOps page, select **User settings** > **Personal access tokens**.
35
35
1. On the **Personal Access Tokens** page, select **New Token**.
36
36
1. Fill out the information for the token, selecting **Read** for the scopes, and then select **Create**.
37
-
1. On the **Success** page, be sure to copy the token, as it won't be shown again.
37
+
1. On the **Success** page, be sure to copy the token, because Azure Repos doesn't store the token or show it again.
38
38
39
39
## Add an artifact repository to a lab in the Azure portal
40
40
@@ -62,7 +62,6 @@ To add a repository to your lab, you need the Git HTTPS clone URL and the person
62
62
63
63
The repository now appears in the **Repositories** list for the lab.
64
64
65
-
66
65
## Add an artifact repository by using an ARM template
67
66
68
67
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).
@@ -71,7 +70,7 @@ The following ARM template adds an artifact repository to a lab. The template c
71
70
72
71
### Review the ARM template
73
72
74
-
This sample template gathers the following information via parameters. Some of the parameters have defaults, but you must specify the lab name, artifact repository URI, repository type, and repository personal access token.
73
+
The sample template gathers the following information in parameters. Some of the parameters have defaults, but the deployment command must specify the lab name, artifact repository URI, repository type, and repository personal access token.
75
74
76
75
- Lab name.
77
76
- Display name for the artifact repository in DevTest Labs. The default value is `Team Repository`.
@@ -156,7 +155,8 @@ There are several ways to deploy ARM templates to create or update Azure resourc
156
155
157
156
For this example, deploy the template by using Azure PowerShell.
158
157
159
-
- The cmdlets used to deploy the template are context-specific, so they use the current tenant and subscription. Use [Set-AzContext](/powershell/module/az.accounts/set-azcontext) before deploying the template to change context if needed.
158
+
> [!NOTE]
159
+
> The cmdlets that deploy the template are context-specific, so they use the current tenant and subscription. If you need to change the context, use [Set-AzContext](/powershell/module/az.accounts/set-azcontext) before you deploy the template
160
160
161
161
1. Create a resource group by using [New-AzResourceGroup](/powershell/module/az.resources/new-azresourcegroup). If the resource group you want to use already exists, skip this step.
162
162
@@ -172,16 +172,14 @@ For this example, deploy the template by using Azure PowerShell.
After `New-AzResourceGroupDeployment` runs successfully, the output shows important information like the provisioning state, which should be succeeded, and any outputs for the template.
175
+
```
176
+
177
+
After `New-AzResourceGroupDeployment` runs successfully, the output shows important information like the provisioning state, which should be `succeeded`, and any outputs for the template.
178
178
179
179
## Add an artifact repository by using Azure PowerShell
180
180
181
181
The following sample PowerShell script, *New-DevTestLabArtifactRepository.ps1*, adds an artifact repository to a lab. The full script includes some verbose messages and comments.
@@ -328,7 +326,7 @@ The PowerShell script takes the following parameters:
328
326
|`SourceType`| Whether the artifact repository is a VSOGit (Azure Repos) or GitHub repository.|
329
327
330
328
331
-
The repository needs an internal name for identification, which is different than the display name in the Azure portal. You don't see the internal name when using the Azure portal, but you see it when using Azure REST APIs or Azure PowerShell. The script creates a random name if the script user doesn't specify one.
329
+
The repository needs an internal name for identification, which is different than the display name in the Azure portal. You don't see the internal name when using the Azure portal, but you see it when using Azure REST APIs or Azure PowerShell. The script creates a random name if the deployment command doesn't specify one.
332
330
333
331
```powershell
334
332
#Set artifact repository name, if not set by user
@@ -346,13 +344,13 @@ The script uses the following PowerShell commands:
346
344
|[Get-AzResource](/powershell/module/az.resources/get-azresource)| Gets details about the lab, such as its location. You create the artifact repository source in the same location and under the same resource group as the lab.|
347
345
|[New-AzResource](/powershell/module/az.resources/new-azresource)| Adds the Azure resource. There's no specific command for adding artifact repositories. This cmdlet needs either the `ResourceId` or the `ResourceName` and `ResourceType` pair to know the type of resource to create. The current script uses the `ResourceName` and `ResourceType` pair. |
348
346
349
-
A good way to discover resource name and resource type information is to use the [Test Drive Azure REST APIs](https://azure.github.io/projects/apis/) website. The [DevTest Labs – 2016-05-15 provider](https://aka.ms/dtlrestapis) shows the available REST APIs for the DevTest Labs provider. This script uses the following resource ID:
347
+
A good way to discover resource name and resource type information is to use the [Azure REST API Browser](https://azure.github.io/projects/apis/) website. DevTest Labs [Artifact Sources](/rest/api/dtl/artifact-sources) shows REST APIs for creating and managing DevTest Labs artifact sources. The current script uses the following resource ID:
The resource type is everything listed after `providers` in the URI, except for items the curly brackets. The resource name is everything in the curly brackets. If you use more than one item for the resource name, separate each item with a slash:
353
+
The resource type is everything listed after `providers` in the URI, except for items in curly brackets. The resource name is everything in the curly brackets. If you use more than one item for the resource name, separate each item with a slash:
Run the PowerShell script, substituting your own values for the example values in `LabName`, `LabResourceGroupName`, `ArtifactRepositoryName`, `RepositoryUri`, `PersonalAccessToken`, and `SourceType`:
You can add *artifacts* to Azure DevTest Labs virtual machines (VMs). DevTest Labs artifacts specify actions to perform when provisioning a VM, such as running Windows PowerShell scripts, running Bash commands, or installing software. You can use parameters to customize artifacts for your scenarios.
11
+
You can add *artifacts* to Azure DevTest Labs virtual machines (VMs). DevTest Labs artifacts specify actions to take to provision a VM, such as running Windows PowerShell scripts, running Bash commands, or installing software. You can use parameters to customize the artifacts for your own needs.
12
12
13
-
DevTest Labs artifacts can come from the [public DevTest Labs Git repository](https://github.com/Azure/azure-devtestlab/tree/master/Artifacts) or from private Git repositories. To create your own custom artifacts and store them in a repository, see [Create custom artifacts](devtest-lab-artifact-author.md). To add your artifact repository to a lab so lab users can access the custom artifacts, see [Add an artifact repository to your lab in DevTest Labs](add-artifact-repository.md).
13
+
DevTest Labs artifacts can come from the [public DevTest Labs Git repository](https://github.com/Azure/azure-devtestlab/tree/master/Artifacts) or from private Git repositories. To create your own custom artifacts and store them in a repository, see [Create custom artifacts](devtest-lab-artifact-author.md). To add your artifact repository to a lab so lab users can access the custom artifacts, see [Add an artifact repository to your lab](add-artifact-repository.md).
14
14
15
15
This article describes how to add available artifacts to VMs by using the Azure portal or Azure PowerShell.
0 commit comments