Skip to content

Commit c9bfd12

Browse files
committed
updates
1 parent 188ff33 commit c9bfd12

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

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

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -190,44 +190,44 @@ To add an artifact repo, complete the following tasks:
190190

191191
1. To add your artifact repository to the lab, select **Add** in the top menu.
192192

193-
:::image type="content" source="media/devtest-lab-add-repo/devtestlab-add-repo.png" alt-text="Screenshot that shows the Repositories configuration screen." lightbox=media/devtest-lab-add-repo/devtestlab-add-repo.png":::
193+
:::image type="content" source="media/devtest-lab-add-repo/devtestlab-add-repo.png" alt-text="Screenshot that shows the Repositories configuration screen." lightbox="media/devtest-lab-add-repo/devtestlab-add-repo.png":::
194194

195195
1. In the **Repository** pane, enter the following information:
196196

197197
- **Name**: A repository name to use in the lab.
198198
- **Git clone URL**: The Git HTTPS clone URL from GitHub Repos.
199199
- **Branch** (optional): The branch that has your artifact definitions.
200200
- **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.
201-
- **GitHub app**: Use this option to leverage GitHub app authentication.
201+
- **GitHub app**: Select this option to use GitHub app authentication.
202202

203203
1. Select **Save**.
204204

205-
![Screenshot that shows adding a new artifact repository to a lab.](media/devtest-lab-add-repo/devtestlab-repo-blade-with-github-app-auth.png)
205+
:::image type="content" source="media/devtest-lab-add-repo/devtestlab-repo-blade-with-github-app-auth.png" alt-text="Screenshot that shows the steps for adding an artifact repository to a lab." lightbox="media/devtest-lab-add-repo/devtestlab-repo-blade-with-github-app-auth.png":::
206206

207207
The repository now appears in the **Repositories** list for the lab.
208208

209209
## [GitHub repo with PAT](#tab/GitHubRepoPAT/)
210210

211211
### Get the clone URL and personal access token for GitHub
212212

213-
1. On the home page of the GitHub repository that has your artifacts, select **Code**, and under **Clone**, copy the HTTPS URL.
213+
1. On the home page of the GitHub repository that stores your artifacts, select **Code**, and under **Clone**, copy the HTTPS URL.
214214
1. Select your profile image in the upper-right corner of GitHub, and then select **Settings**.
215215
1. On your profile page, in the left menu, select **Developer Settings**, and then select **Personal access tokens**.
216216
1. Select **Generate new token**.
217-
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**.
217+
1. On the **New personal access token** page, under **Note**, enter a description for the token, if you want. Accept all the defaults, and then select **Generate token**.
218218
1. Save the generated token.
219219

220220
### Add a GitHub artifact repository to a lab in the Azure portal
221221

222-
1. On the lab's **Overview** page, select **Configuration and policies** from the left navigation.
222+
1. On the lab's **Overview** page, select **Configuration and policies** in the left pane.
223223

224-
1. On the **Configuration and policies** page, select **Repositories** under **External resources** in the left navigation.
224+
1. On the **Configuration and policies** page, select **Repositories** under **External resources** in the left pane.
225225

226-
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.
226+
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** in menu at the top of the pane.
227227

228-
1. To add your artifact repository to the lab, select **Add** in the top menu bar.
228+
1. To add your artifact repository to the lab, select **Add** in the top menu.
229229

230-
![Screenshot that shows the Repositories configuration screen.](media/devtest-lab-add-repo/devtestlab-add-repo.png)
230+
:::image type="content" source="media/devtest-lab-add-repo/devtestlab-add-repo.png" alt-text="Screenshot that shows the Repositories configuration screen." lightbox="media/devtest-lab-add-repo/devtestlab-add-repo.png":::
231231

232232
1. In the **Repository** pane, enter the following information:
233233

@@ -240,7 +240,7 @@ The repository now appears in the **Repositories** list for the lab.
240240

241241
1. Select **Save**.
242242

243-
![Screenshot that shows adding a new artifact repository to a lab.](media/devtest-lab-add-repo/devtestlab-repo-blade-with-github-pat.png)
243+
:::image type="content" source="media/devtest-lab-add-repo/devtestlab-repo-blade-with-github-pat.png" alt-text="Screenshot that shows the fields for adding a new artifact repository to a lab." lightbox="media/devtest-lab-add-repo/devtestlab-repo-blade-with-github-pat.png":::
244244

245245
The repository now appears in the **Repositories** list for the lab.
246246

@@ -250,7 +250,7 @@ The repository now appears in the **Repositories** list for the lab.
250250

251251
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).
252252

253-
The following ARM template adds an artifact repository to a lab. The template creates the lab if it doesn't already exist.
253+
The following ARM template adds an artifact repository to a lab. If the lab doesn't already exist, the template creates it.
254254

255255
### Review the ARM template
256256

@@ -337,7 +337,7 @@ There are several ways to deploy ARM templates to create or update Azure resourc
337337
- [Deploy resources with ARM templates in the Azure portal](../azure-resource-manager/templates/deploy-portal.md)
338338
- [Deploy resources with ARM templates and Resource Manager REST API](../azure-resource-manager/templates/deploy-rest.md)
339339

340-
For this example, deploy the template by using Azure PowerShell.
340+
For this procedure, deploy the template by using Azure PowerShell.
341341

342342
> [!NOTE]
343343
> 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
@@ -369,7 +369,7 @@ The following sample PowerShell script, *New-DevTestLabArtifactRepository.ps1*,
369369
<#
370370
371371
.SYNOPSIS
372-
This script creates a new custom repository and adds it to an existing DevTest Lab.
372+
This script creates a new custom repository and adds it to an existing DevTest lab.
373373
374374
.PARAMETER LabName
375375
The name of the lab.
@@ -378,20 +378,20 @@ The name of the lab.
378378
The name of the resource group that contains the lab.
379379
380380
.PARAMETER ArtifactRepositoryName
381-
Name for the new artifact repository. The script creates a random name for the repository if not specified.
381+
Name for the new artifact repository. The script creates a random name for the repository if a name isn't specified.
382382
383383
.PARAMETER ArtifactRepositoryDisplayName
384384
Display name for the artifact repository.
385385
This name appears in the list of artifact repositories for a lab.
386386
387387
.PARAMETER RepositoryUri
388-
Uri to the artifact repository.
388+
URI to the artifact repository.
389389
390390
.PARAMETER RepositoryBranch
391391
Branch that contains the artifact files. Defaults to 'main'.
392392
393393
.PARAMETER FolderPath
394-
Folder that contains the artifact files. Defaults to '/Artifacts'
394+
Folder that contains the artifact files. Defaults to '/Artifacts'.
395395
396396
.PARAMETER PersonalAccessToken
397397
Personal access token for the GitHub or Azure Repos repository.
@@ -433,7 +433,7 @@ Param(
433433
$SourceType
434434
)
435435
436-
# Set artifact repository internal name if not specified.
436+
# Set artifact repository internal name if it's not specified.
437437
438438
if ($ArtifactRepositoryName -eq $null){
439439
$ArtifactRepositoryName = "PrivateRepo" + (Get-Random -Maximum 999)
@@ -443,7 +443,7 @@ if ($ArtifactRepositoryName -eq $null){
443443
Connect-AzAccount
444444
445445
446-
#Get Lab Resource.
446+
# Get lab resource.
447447
$LabResource = Get-AzResource -ResourceType 'Microsoft.DevTestLab/labs' -ResourceName $LabName -ResourceGroupName $LabResourceGroupName
448448
449449
Write-Verbose "Lab Name: $($LabResource.Name)"
@@ -452,7 +452,7 @@ Write-Verbose "Lab Resource Location: $($LabResource.Location)"
452452
453453
Write-Verbose "Artifact Repository Internal Name: $ArtifactRepositoryName"
454454
455-
#Prepare properties object for the call to New-AzResource.
455+
# Prepare properties object for the call to New-AzResource.
456456
$propertiesObject = @{
457457
uri = $RepositoryUri;
458458
folderPath = $FolderPath;
@@ -465,7 +465,7 @@ $propertiesObject = @{
465465
466466
Write-Verbose "Properties to be passed to New-AzResource:$($propertiesObject | Out-String)"
467467
468-
#Add resource to the current subscription.
468+
# Add resource to the current subscription.
469469
$resourcetype = 'Microsoft.DevTestLab/labs/artifactSources'
470470
$resourceName = $LabName + '/' + $ArtifactRepositoryName
471471
Write-Verbose "Az ResourceType: $resourcetype"
@@ -474,13 +474,12 @@ Write-Verbose "Az ResourceName: $resourceName"
474474
Write-Verbose "Creating artifact repository '$ArtifactRepositoryDisplayName'..."
475475
$result = New-AzResource -Location $LabResource.Location -ResourceGroupName $LabResource.ResourceGroupName -properties $propertiesObject -ResourceType $resourcetype -ResourceName $resourceName -ApiVersion 2016-05-15 -Force
476476
477-
#Alternate implementation:
477+
# Alternate implementation:
478478
# Use resourceId rather than resourcetype and resourcename parameters.
479479
# Using resourceId lets you specify the $SubscriptionId rather than using the
480480
# subscription id of Get-AzContext.
481-
#$resourceId = "/subscriptions/$SubscriptionId/resourceGroups/$($LabResource.ResourceGroupName)/providers/Microsoft.DevTestLab/labs/$LabName/artifactSources/$ArtifactRepositoryName"
482-
#$result = New-AzResource -properties $propertiesObject -ResourceId $resourceId -ApiVersion 2016-05-15 -Force
483-
481+
# $resourceId = "/subscriptions/$SubscriptionId/resourceGroups/$($LabResource.ResourceGroupName)/providers/Microsoft.DevTestLab/labs/$LabName/artifactSources/$ArtifactRepositoryName"
482+
# $result = New-AzResource -properties $propertiesObject -ResourceId $resourceId -ApiVersion 2016-05-15 -Force
484483
485484
# Check the result.
486485
if ($result.Properties.ProvisioningState -eq "Succeeded") {
@@ -490,7 +489,7 @@ else {
490489
Write-Error ("Error adding artifact repository source '$ArtifactRepositoryDisplayName'")
491490
}
492491
493-
#Return the newly created resource to use in later scripts.
492+
# Return the newly created resource to use in later scripts.
494493
return $result
495494
```
496495

@@ -501,19 +500,18 @@ The PowerShell script takes the following parameters:
501500
| Parameter | Description |
502501
| --------- | ----------- |
503502
| `LabName` | The name of the lab. |
504-
| `ArtifactRepositoryName` | Name for the new artifact repository. The script creates a random name for the repository if it isn't specified. |
503+
| `ArtifactRepositoryName` | Name for the new artifact repository. The script creates a random name for the repository if a name isn't specified. |
505504
| `ArtifactRepositoryDisplayName` | Display name that appears in the lab's artifact repository list. |
506-
| `RepositoryUri` | URI of the artifact repository, which you copied earlier.|
505+
| `RepositoryUri` | URI of the artifact repository. You copeied this value earlier.|
507506
| `RepositoryBranch` | Repository branch that contains the artifacts. The default value is `main`.|
508-
| `FolderPath` | Folder that contains the artifacts. The default value is: `/Artifacts`.|
509-
| `PersonalAccessToken` | Security token for accessing the repository, which you copied earlier.|
510-
| `SourceType` | Whether the artifact repository is a VSOGit (Azure Repos) or GitHub repository.|
511-
507+
| `FolderPath` | Folder that contains the artifacts. The default value is `/Artifacts`.|
508+
| `PersonalAccessToken` | Security token for accessing the repository. You copied this value earlier.|
509+
| `SourceType` | Whether the artifact repository is a `VSOGit` (Azure Repos) or GitHub repository.|
512510

513-
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.
511+
The repository needs an internal name for identification. This name is different from 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.
514512

515513
```powershell
516-
#Set artifact repository name, if not set by user
514+
# Set artifact repository name, if it's not set by user.
517515
if ($ArtifactRepositoryName -eq $null){
518516
$ArtifactRepositoryName = "PrivateRepo" + (Get-Random -Maximum 999)
519517
}
@@ -526,15 +524,15 @@ The script uses the following PowerShell commands:
526524
| Command | Notes |
527525
| ------------------ | ----- |
528526
| [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.|
529-
| [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. |
527+
| [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 preceding script uses the `ResourceName` and `ResourceType` pair. |
530528

531-
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:
529+
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 preceding script uses the following resource ID:
532530

533531
```powershell
534532
https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}
535533
```
536534

537-
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:
535+
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:
538536

539537
```powershell
540538
$resourcetype = 'Microsoft.DevTestLab/labs/artifactSources'
@@ -544,12 +542,14 @@ $resourceName = $LabName + '/' + $ArtifactRepositoryName
544542
### Run the PowerShell script
545543

546544
Run the PowerShell script, substituting your own values for the example values in `LabName`, `LabResourceGroupName`, `ArtifactRepositoryName`, `RepositoryUri`, `PersonalAccessToken`, and `SourceType`:
545+
547546
```powershell
548547
Set-AzContext -SubscriptionId <Your Azure subscription ID>
549548
550549
.\New-DevTestLabArtifactRepository.ps1 -LabName "mydevtestlab" -LabResourceGroupName "mydtlrg" -ArtifactRepositoryName "myteamrepository" -RepositoryUri "https://github.com/myteam/myteamrepository.git" - "1111...." -SourceType "GitHub"
551550
```
552551

553-
## Next steps
552+
## Related content
553+
554554
- [Specify mandatory artifacts for DevTest Labs VMs](devtest-lab-mandatory-artifacts.md)
555555
- [Diagnose artifact failures in the lab](devtest-lab-troubleshoot-artifact-failure.md)

0 commit comments

Comments
 (0)