Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7ec813f

Browse files
committedJan 5, 2022
fixes
1 parent 712ad46 commit 7ec813f

File tree

6 files changed

+44
-45
lines changed

6 files changed

+44
-45
lines changed
 

‎.openpublishing.redirection.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16109,13 +16109,13 @@
1610916109
},
1611016110
{
1611116111
"source_path_from_root": "/articles/lab-services/devtest-lab-add-artifact-repo.md",
16112-
"redirect_url": "/azure/devtest-labs/devtest-lab-add-artifact-repository",
16113-
"redirect_document_id": false
16112+
"redirect_url": "/azure/devtest-labs/add-artifact-repository",
16113+
"redirect_document_id": true
1611416114
},
1611516115
{
1611616116
"source_path_from_root": "/articles/devtest-labs/devtest-lab-add-artifact-repo.md",
16117-
"redirect_url": "/azure/devtest-labs/devtest-lab-add-artifact-repository",
16118-
"redirect_document_id": false
16117+
"redirect_url": "/azure/devtest-labs/add-artifact-repository",
16118+
"redirect_document_id": true
1611916119
},
1612016120
{
1612116121
"source_path_from_root": "/articles/lab-services/devtest-lab-add-claimable-vm.md",

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

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,35 @@ ms.date: 01/04/2022
66
ms.custom: devx-track-azurepowershell
77
---
88

9-
# Add an artifact repository to your lab in DevTest Labs
9+
# Add an artifact repository to a lab
1010

1111
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.
1212

1313
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).
1414

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.
1616

1717
[!INCLUDE [updated-for-az](../../includes/updated-for-az.md)]
1818

1919
## Prerequisites
20-
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.
2121

22-
### Clone URL and personal access token for GitHub
22+
### Get the clone URL and personal access token for GitHub
2323

2424
1. On the home page of the GitHub repository that has your artifacts, select **Code**, and under **Clone**, copy the HTTPS URL.
2525
1. Select your profile image in the upper-right corner of GitHub, and then select **Settings**.
2626
1. On your profile page, in the left menu, select **Developer Settings**, and then select **Personal access tokens**.
2727
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**.
2929
1. Save the generated token.
3030

31-
### Clone URL and personal access token for Azure Repos
31+
### Get the clone URL and personal access token for Azure Repos
3232

3333
1. On the main page of the repository that has your artifacts, select **Clone**. On the **Clone Repository** page, copy the clone URL.
3434
1. In the upper-right corner of the Azure DevOps page, select **User settings** > **Personal access tokens**.
3535
1. On the **Personal Access Tokens** page, select **New Token**.
3636
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.
3838

3939
## Add an artifact repository to a lab in the Azure portal
4040

@@ -62,7 +62,6 @@ To add a repository to your lab, you need the Git HTTPS clone URL and the person
6262

6363
The repository now appears in the **Repositories** list for the lab.
6464

65-
6665
## Add an artifact repository by using an ARM template
6766

6867
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
7170

7271
### Review the ARM template
7372

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.
7574

7675
- Lab name.
7776
- 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
156155

157156
For this example, deploy the template by using Azure PowerShell.
158157

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
160160
161161
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.
162162

@@ -172,16 +172,14 @@ For this example, deploy the template by using Azure PowerShell.
172172
-ResourceGroupName MyLabResourceGroup1 `
173173
-TemplateFile azuredeploy.json `
174174
-TemplateParameterFile azuredeploy.parameters.json
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.
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.
178178

179179
## Add an artifact repository by using Azure PowerShell
180180

181181
The following sample PowerShell script, *New-DevTestLabArtifactRepository.ps1*, adds an artifact repository to a lab. The full script includes some verbose messages and comments.
182182

183-
[!INCLUDE [updated-for-az](../../includes/updated-for-az.md)]
184-
185183
```powershell
186184
187185
<#
@@ -328,7 +326,7 @@ The PowerShell script takes the following parameters:
328326
| `SourceType` | Whether the artifact repository is a VSOGit (Azure Repos) or GitHub repository.|
329327

330328

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.
332330

333331
```powershell
334332
#Set artifact repository name, if not set by user
@@ -346,13 +344,13 @@ The script uses the following PowerShell commands:
346344
| [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.|
347345
| [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. |
348346

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:
350348

351349
```powershell
352-
"/subscriptions/$SubscriptionId/resourceGroups/$($LabResource.ResourceGroupName)/providers/Microsoft.DevTestLab/labs/$LabName/artifactSources/$ArtifactRepositoryName"
350+
https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}
353351
```
354352

355-
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:
356354

357355
```powershell
358356
$resourcetype = 'Microsoft.DevTestLab/labs/artifactSources'
@@ -361,12 +359,11 @@ $resourceName = $LabName + '/' + $ArtifactRepositoryName
361359

362360
### Run the PowerShell script
363361

364-
Run the PowerShell script as follows:
365-
362+
Run the PowerShell script, substituting your own values for the example values in `LabName`, `LabResourceGroupName`, `ArtifactRepositoryName`, `RepositoryUri`, `PersonalAccessToken`, and `SourceType`:
366363
```powershell
367364
Set-AzContext -SubscriptionId <Your Azure subscription ID>
368365
369-
.\New-DevTestLabArtifactRepository.ps1 -LabName "mydevtestlab" -LabResourceGroupName "mydtlrg" -ArtifactRepositoryName "MyTeam Repository" -RepositoryUri "https://github.com/<myteam>/<nameofrepo>.git" -PersonalAccessToken "1111...." -SourceType "GitHub"
366+
.\New-DevTestLabArtifactRepository.ps1 -LabName "mydevtestlab" -LabResourceGroupName "mydtlrg" -ArtifactRepositoryName "myteamrepository" -RepositoryUri "https://github.com/myteam/myteamrepository.git" - "1111...." -SourceType "GitHub"
370367
```
371368

372369
## Next steps

‎articles/devtest-labs/add-artifact-vm.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ ms.custom: devx-track-azurepowershell
88

99
# Add artifacts to DevTest Labs VMs
1010

11-
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.
1212

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).
1414

1515
This article describes how to add available artifacts to VMs by using the Azure portal or Azure PowerShell.
1616

0 commit comments

Comments
 (0)
Please sign in to comment.