Skip to content

Commit c71cc18

Browse files
committed
script lines
1 parent 207ae60 commit c71cc18

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ If necessary, sign in to your Azure account by using the [Connect-AzAccount](/po
8282
Run the following PowerShell script to apply an artifact to a VM by using the [Invoke-AzResourceAction](/powershell/module/az.resources/invoke-azresourceaction) cmdlet. Provide the information the script calls for when prompted.
8383

8484
```powershell
85-
#Requires -Module Az.Resources
86-
8785
param (
8886
[Parameter(Mandatory=$true, HelpMessage="The ID of the subscription that contains the lab")]
8987
[string] $SubscriptionId,
@@ -107,12 +105,22 @@ $resourceGroupName = (Get-AzResource -ResourceType 'Microsoft.DevTestLab/labs' |
107105
if ($resourceGroupName -eq $null) { throw "Unable to find lab $DevTestLabName in subscription $SubscriptionId." }
108106
109107
# Get the internal repository name
110-
$repository = Get-AzResource -ResourceGroupName $resourceGroupName -ResourceType 'Microsoft.DevTestLab/labs/artifactsources' -ResourceName $DevTestLabName -ApiVersion 2016-05-15 | Where-Object { $RepositoryName -in ($_.Name, $_.Properties.displayName) } | Select-Object -First 1
108+
$repository = Get-AzResource -ResourceGroupName $resourceGroupName `
109+
-ResourceType 'Microsoft.DevTestLab/labs/artifactsources' `
110+
-ResourceName $DevTestLabName `
111+
-ApiVersion 2016-05-15 `
112+
| Where-Object { $RepositoryName -in ($_.Name, $_.Properties.displayName) } `
113+
| Select-Object -First 1
111114
112115
if ($repository -eq $null) { "Unable to find repository $RepositoryName in lab $DevTestLabName." }
113116
114117
# Get the internal artifact name
115-
$template = Get-AzResource -ResourceGroupName $resourceGroupName -ResourceType "Microsoft.DevTestLab/labs/artifactSources/artifacts" -ResourceName "$DevTestLabName/$($repository.Name)" -ApiVersion 2016-05-15 | Where-Object { $ArtifactName -in ($_.Name, $_.Properties.title) } | Select-Object -First 1
118+
$template = Get-AzResource -ResourceGroupName $resourceGroupName `
119+
-ResourceType "Microsoft.DevTestLab/labs/artifactSources/artifacts" `
120+
-ResourceName "$DevTestLabName/$($repository.Name)" `
121+
-ApiVersion 2016-05-15 `
122+
| Where-Object { $ArtifactName -in ($_.Name, $_.Properties.title) } `
123+
| Select-Object -First 1
116124
117125
if ($template -eq $null) { throw "Unable to find template $ArtifactName in lab $DevTestLabName." }
118126

0 commit comments

Comments
 (0)