Skip to content

Commit 3fa5388

Browse files
committed
3 articles
1 parent 77b6e44 commit 3fa5388

13 files changed

+168
-180
lines changed

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

Lines changed: 53 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,89 @@
11
---
2-
title: Add an artifact to a VM
3-
description: Learn how to add an artifact to a virtual machine in a lab in Azure DevTest Labs.
2+
title: Add artifacts to VMs
3+
description: Learn how to add or configure artifacts on lab virtual machines (VM) in Azure DevTest Labs by using the Azure portal or Azure PowerShell.
44
ms.topic: how-to
55
ms.author: rosemalcolm
66
author: RoseHJM
7-
ms.date: 09/30/2023
7+
ms.date: 03/24/2025
88
ms.custom: devx-track-azurepowershell, UpdateFrequency2
9+
10+
#customer intent: As a lab user, I want to add artifacts to my VMs so I can use them to run scripts or commands, install tools or applications, or take other actions on my VMs.
911
---
1012

1113
# Add artifacts to DevTest Labs VMs
1214

13-
This article describes how to add *artifacts* to Azure DevTest Labs virtual machines (VMs). 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.
15+
This article describes how to add *artifacts* to Azure DevTest Labs virtual machines (VMs). Artifacts are tools, actions, or software you can add to lab VMs. For example, artifacts can run Windows PowerShell scripts or Bash commands, install tools or applications, or take other actions like joining a domain.
16+
17+
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. Lab users can [create their own custom artifacts](devtest-lab-artifact-author.md) and store them in a repository, or use parameters to customize artifacts for their own needs.
18+
19+
A lab administrator can [add artifact repositories to a lab](add-artifact-repository.md) so all lab users can access them. Lab administrators can also [specify mandatory artifacts to be installed on all lab VMs](devtest-lab-mandatory-artifacts.md) at creation.
20+
21+
You can't change or remove mandatory artifacts at VM creation time, but you can add and configure other available individual artifacts at or after creation time. This article describes how to add available artifacts to VMs by using the Azure portal or Azure PowerShell.
22+
23+
## Prerequisites
24+
25+
# [Azure portal](#tab/portal)
1426

15-
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).
27+
- User access to a lab in DevTest Labs.
1628

17-
DevTest Labs lab owners can specify mandatory artifacts to be installed on all lab VMs at creation. For more information, see [Specify mandatory artifacts for DevTest Labs VMs](devtest-lab-mandatory-artifacts.md).
29+
# [Azure PowerShell](#tab/PowerShell)
1830

19-
You can't change or remove mandatory artifacts at VM creation time, but you can add any available individual artifacts. This article describes how to add available artifacts to VMs by using the Azure portal or Azure PowerShell.
31+
- User access to a lab in DevTest Labs.
32+
- Azure PowerShell. You can either:
33+
- [Use Azure Cloud Shell](/azure/cloud-shell/quickstart). Be sure to select the **PowerShell** environment.
34+
- [Install Azure PowerShell](/powershell/azure/install-azure-powershell) to use on a physical or virtual machine. If necessary, run `Update-Module -Name Az` to update your installation.
2035

21-
## Add artifacts to VMs from the Azure portal
36+
---
37+
38+
## Add artifacts to VMs
39+
40+
# [Azure portal](#tab/portal)
2241

23-
You can add artifacts during VM creation, or add artifacts to existing lab VMs.
42+
You can use the Azure portal to add artifacts during VM creation or to add artifacts to an existing lab VM.
2443

25-
To add artifacts during VM creation:
44+
### Add artifacts during VM creation
2645

2746
1. On the lab's home page, select **Add**.
2847
1. On the **Choose a base** page, select the type of VM you want.
29-
1. On the **Create lab resource** screen, select **Add or Remove Artifacts**.
48+
1. On the **Create lab resource** screen, fill out the **Basic Settings** tab according to the instructions at [Create lab VMs in Azure DevTest Labs](devtest-lab-add-vm.md).
49+
1. At the bottom of the **Basic Settings** tab, select **Add or Remove Artifacts**.
3050
1. On the **Add artifacts** page, select the arrow next to each artifact you want to add to the VM.
31-
1. On each **Add artifact** pane, enter any required and optional parameter values, and then select **OK**. The artifact appears under **Selected artifacts**, and the number of configured artifacts updates.
51+
1. On each **Add artifact** pane, enter any required and optional parameter values, and then select **OK**. The artifact appears under **Selected artifacts** on the **Add artifacts** page, and the number of configured artifacts updates.
3252

3353
:::image type="content" source="./media/add-artifact-vm/devtestlab-add-artifacts-blade-selected-artifacts.png" alt-text="Screenshot that shows adding artifacts on the Add artifacts pane.":::
3454

35-
1. You can change the artifacts after adding them.
55+
1. By default, artifacts install in the order you add them. To rearrange the order, select the ellipsis **...** next to the artifact in the **Selected artifacts** list, and select **Move up**, **Move down**, **Move to top**, or **Move to bottom**.
3656

37-
- By default, artifacts install in the order you add them. To rearrange the order, select the ellipsis **...** next to the artifact in the **Selected artifacts** list, and select **Move up**, **Move down**, **Move to top**, or **Move to bottom**.
38-
- To edit the artifact's parameters, select **Edit** to reopen the **Add artifact** pane.
39-
- To delete the artifact from the **Selected artifacts** list, select **Delete**.
57+
- To edit an artifact's parameters after you add it, select the pencil icon, or select **...** next to the artifact and select **Edit**, to reopen the **Add artifact** pane.
58+
- To delete an artifact from the **Selected artifacts** list, select **...** and then select **Delete**.
4059

41-
1. When you're done adding and arranging artifacts, select **OK**.
42-
1. The **Create lab resource** screen shows the number of artifacts added. To add, edit, rearrange, or delete the artifacts before you create the VM, select **Add or Remove Artifacts** again.
60+
1. When you're done adding, arranging, and configuring artifacts, select **OK** on the **Add artifacts** page.
61+
1. The **Artifacts** section of the **Create lab resource** screen shows the number of artifacts added. To add, edit, rearrange, or delete the artifacts before you create the VM, select **Add or Remove Artifacts** again.
62+
1. Optionally configure any **Advanced Settings** or **Tags**, and then select **Create** and **Create** again at the bottom of the **Create lab resource** screen to create the VM.
4363

4464
After you create the VM, the installed artifacts appear on the VM's **Artifacts** page. To see details about each artifact's installation, select the artifact name.
4565

46-
To install artifacts on an existing VM:
66+
### Add artifacts to an existing VM
4767

4868
1. From the lab's home page, select the VM from the **My virtual machines** list.
49-
1. On the VM page, select **Artifacts** in the top menu bar or left navigation.
69+
1. On the VM page, select **Artifacts** in the top menu bar or under **Operations** in the left navigation.
5070
1. On the **Artifacts** page, select **Apply artifacts**.
5171

52-
:::image type="content" source="./media/add-artifact-vm/artifacts.png" alt-text="Screenshot that shows Artifacts pane for an existing V M.":::
72+
:::image type="content" source="./media/add-artifact-vm/artifacts.png" alt-text="Screenshot that shows the Artifacts pane for an existing VM.":::
5373

54-
1. On the **Add artifacts** page, select and configure artifacts the same as for a new VM.
74+
1. On the **Add artifacts** page, select and configure artifacts the same way as for a new VM.
5575
1. When you're done adding artifacts, select **Install**. The artifacts install on the VM immediately.
5676

57-
## Add artifacts to VMs by using Azure PowerShell
77+
# [Azure PowerShell](#tab/PowerShell)
5878

59-
[!INCLUDE [updated-for-az](~/reusable-content/ce-skilling/azure/includes/updated-for-az.md)]
79+
If necessary, sign in to your Azure account by using the [Connect-AzAccount](/powershell/module/Az.Accounts/Connect-AzAccount) cmdlet. If you have multiple Azure subscriptions, use `Set-AzContext -SubscriptionId "<SubscriptionId>"` and provide the subscription ID you want to use.
6080

61-
The following PowerShell script applies an artifact to a VM by using the [Invoke-AzResourceAction](/powershell/module/az.resources/invoke-azresourceaction) cmdlet.
81+
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.
6282

6383
```powershell
6484
#Requires -Module Az.Resources
6585
66-
param
67-
(
86+
param (
6887
[Parameter(Mandatory=$true, HelpMessage="The ID of the subscription that contains the lab")]
6988
[string] $SubscriptionId,
7089
[Parameter(Mandatory=$true, HelpMessage="The name of the lab that has the VM")]
@@ -87,35 +106,22 @@ $resourceGroupName = (Get-AzResource -ResourceType 'Microsoft.DevTestLab/labs' |
87106
if ($resourceGroupName -eq $null) { throw "Unable to find lab $DevTestLabName in subscription $SubscriptionId." }
88107
89108
# Get the internal repository name
90-
$repository = Get-AzResource -ResourceGroupName $resourceGroupName `
91-
-ResourceType 'Microsoft.DevTestLab/labs/artifactsources' `
92-
-ResourceName $DevTestLabName `
93-
-ApiVersion 2016-05-15 `
94-
| Where-Object { $RepositoryName -in ($_.Name, $_.Properties.displayName) } `
95-
| Select-Object -First 1
109+
$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
96110
97111
if ($repository -eq $null) { "Unable to find repository $RepositoryName in lab $DevTestLabName." }
98112
99113
# Get the internal artifact name
100-
$template = Get-AzResource -ResourceGroupName $resourceGroupName `
101-
-ResourceType "Microsoft.DevTestLab/labs/artifactSources/artifacts" `
102-
-ResourceName "$DevTestLabName/$($repository.Name)" `
103-
-ApiVersion 2016-05-15 `
104-
| Where-Object { $ArtifactName -in ($_.Name, $_.Properties.title) } `
105-
| Select-Object -First 1
114+
$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
106115
107116
if ($template -eq $null) { throw "Unable to find template $ArtifactName in lab $DevTestLabName." }
108117
109118
# Find the VM in Azure
110-
$FullVMId = "/subscriptions/$SubscriptionId/resourceGroups/$resourceGroupName`
111-
/providers/Microsoft.DevTestLab/labs/$DevTestLabName/virtualmachines/$virtualMachineName"
119+
$FullVMId = "/subscriptions/$SubscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.DevTestLab/labs/$DevTestLabName/virtualmachines/$virtualMachineName"
112120
113121
$virtualMachine = Get-AzResource -ResourceId $FullVMId
114122
115123
# Generate the artifact id
116-
$FullArtifactId = "/subscriptions/$SubscriptionId/resourceGroups/$resourceGroupName`
117-
/providers/Microsoft.DevTestLab/labs/$DevTestLabName/artifactSources/$($repository.Name)`
118-
/artifacts/$($template.Name)"
124+
$FullArtifactId = "/subscriptions/$SubscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.DevTestLab/labs/$DevTestLabName/artifactSources/$($repository.Name)/artifacts/$($template.Name)"
119125
120126
# Handle the input parameters to pass through
121127
$artifactParameters = @()
@@ -153,10 +159,11 @@ if ($virtualMachine -ne $null) {
153159
} else {
154160
Write-Error "##[error]$VirtualMachine was not found in the DevTest Lab, unable to apply the artifact"
155161
}
156-
157162
```
158163

159-
## Next steps
164+
---
165+
166+
## Related content
160167

161168
- [Specify mandatory artifacts](devtest-lab-mandatory-artifacts.md)
162169
- [Create custom artifacts](devtest-lab-artifact-author.md)

0 commit comments

Comments
 (0)