Skip to content

Commit d130ed8

Browse files
authored
Merge pull request #222325 from ktoliver/2017675
edit pass: upload VHD file to lab storage account (2017675)
2 parents 60fcc9d + 087b33e commit d130ed8

17 files changed

+132
-98
lines changed
Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,77 @@
11
---
2-
title: Upload VHD file to Azure DevTest Labs using AzCopy
3-
description: This article provides a walkthrough to use the AzCopy command-line utility to upload a VHD file to a lab's storage account in Azure DevTest Labs.
2+
title: Upload a VHD file to Azure DevTest Labs by using AzCopy
3+
description: Walk through the steps to use the AzCopy command-line utility to upload a VHD file to a lab storage account in Azure DevTest Labs.
44
ms.topic: how-to
55
ms.author: rosemalcolm
66
author: RoseHJM
7-
ms.date: 06/26/2020
7+
ms.date: 12/22/2022
88
---
99

10-
# Upload VHD file to lab's storage account using AzCopy
10+
# Upload a VHD file to a lab storage account by using AzCopy
1111

1212
[!INCLUDE [devtest-lab-upload-vhd-selector](../../includes/devtest-lab-upload-vhd-selector.md)]
1313

14-
In Azure DevTest Labs, VHD files can be used to create custom images, which are used to provision virtual machines.
15-
The following steps walk you through using the AzCopy command-line utility to upload a VHD file to a lab's storage account. Once you've uploaded your VHD file, the [Next steps section](#next-steps) lists some articles that illustrate how to create a custom image from the uploaded VHD file. For more information about disks and VHDs in Azure, see [Introduction to managed disks](../virtual-machines/managed-disks-overview.md)
14+
In this article, learn how to use the AzCopy command-line utility to upload a VHD file to a lab storage account in Azure DevTest Labs. After you upload your VHD file, you can create a custom image from the uploaded VHD file and use the image to provision a virtual machine.
1615

17-
> [!NOTE]
16+
For more information about disks and VHDs in Azure, see [Introduction to managed disks](../virtual-machines/managed-disks-overview.md).
17+
18+
> [!NOTE]
1819
>
1920
> AzCopy is a Windows-only command-line utility.
2021
21-
## Step-by-step instructions
22+
## Prerequisites
23+
24+
- Download and install the [latest version of AzCopy](https://aka.ms/downloadazcopy).
25+
26+
To upload a VHD file to a lab storage account by using AzCopy, first, get the lab storage account name via the Azure portal. Then, use AzCopy to upload the file.
2227

23-
The following steps walk you through uploading a VHD file to Azure DevTest Labs using [AzCopy](https://aka.ms/downloadazcopy).
28+
## Get the lab storage account name
2429

25-
1. Get the name of the lab's storage account using the Azure portal:
30+
To get the name of the lab storage account:
2631

2732
1. Sign in to the [Azure portal](https://go.microsoft.com/fwlink/p/?LinkID=525040).
2833

29-
1. Select **All services**, and then select **DevTest Labs** from the list.
34+
1. Select **All resources**, and then select your lab.
35+
36+
1. In the lab menu under **Settings**, select **Configuration and policies**.
37+
38+
1. In **Activity log**, in the resource menu under **Virtual machine bases**, select **Custom images**.
39+
40+
1. In **Custom images**, select **Add**.
3041

31-
1. From the list of labs, select the desired lab.
42+
1. In **Custom image**, under **VHD**, select the **Upload an image using PowerShell** link.
3243

33-
1. On the lab's blade, select **Configuration**.
44+
:::image type="content" source="media/devtest-lab-upload-vhd-using-azcopy/upload-image-powershell.png" alt-text="Screenshot that shows settings to upload a VHD by using PowerShell on the Custom image pane.":::
3445

35-
1. On the lab **Configuration** blade, select **Custom images (VHDs)**.
46+
1. In **Upload an image using PowerShell**, scroll right to see a call to the Add-AzureRmVhd cmdlet.
3647

37-
1. On the **Custom images** blade, Select **+Add**.
48+
The `-Destination` parameter contains the URI for a blob container in the following format:
3849

39-
1. On the **Custom image** blade, select **VHD**.
50+
`https://<storageAccountName>.blob.core.windows.net/uploads/...`
4051

41-
1. On the **VHD** blade, select **Upload a VHD using PowerShell**.
52+
:::image type="content" source="media/devtest-lab-upload-vhd-using-azcopy/destination-parameter.png" alt-text="Screenshot that shows an example of a URI in the Add VHD box.":::
4253

43-
![Upload VHD using PowerShell](./media/devtest-lab-upload-vhd-using-azcopy/upload-image-using-psh.png)
54+
1. Copy the storage account URI to use in the next section.
4455

45-
1. The **Upload an image using PowerShell** blade displays a call to the **Add-AzureVhd** cmdlet.
46-
The first parameter (*Destination*) contains the URI for a blob container (*uploads*) in the following format:
56+
## Upload a VHD file
4757

48-
```
49-
https://<STORAGE-ACCOUNT-NAME>.blob.core.windows.net/uploads/...
50-
```
58+
To upload a VHD file by using AzCopy:
5159

52-
1. Make note of the full URI as it is used in later steps.
60+
1. In Windows, open a Command Prompt window and go to the AzCopy installation directory.
5361

54-
1. Upload the VHD file using AzCopy:
55-
56-
1. [Download and install the latest version of AzCopy](https://aka.ms/downloadazcopy).
62+
By default, AzCopy is installed in *ProgramFiles(x86)\Microsoft SDKs\Azure\AzCopy*.
5763

58-
1. Open a command window and navigate to the AzCopy installation directory. Optionally, you can add the AzCopy installation location to your system path. By default, AzCopy is installed to the following directory:
64+
Optionally, you can add the AzCopy installation location to your system path.
5965

60-
```command-line
61-
%ProgramFiles(x86)%\Microsoft SDKs\Azure\AzCopy
62-
```
66+
1. At the command prompt, run the following command. Use the storage account key and blob container URI you copied from the Azure portal. The value for `vhdFileName` must be in quotes.
6367

64-
1. Using the storage account key and blob container URI, run the following command at the command prompt. The *vhdFileName* value needs to be in quotes. The process of uploading a VHD file can be lengthy depending on the size of the VHD file and your connection speed.
68+
```cmd
69+
AzCopy /Source:<sourceDirectory> /Dest:<blobContainerUri> /DestKey:<storageAccountKey> /Pattern:"<vhdFileName>" /BlobType:page
70+
```
6571
66-
```command-line
67-
AzCopy /Source:<sourceDirectory> /Dest:<blobContainerUri> /DestKey:<storageAccountKey> /Pattern:"<vhdFileName>" /BlobType:page
68-
```
72+
The process of uploading a VHD file might be lengthy depending on the size of the VHD file and your connection speed.
6973
7074
## Next steps
7175
72-
- [Create a custom image in Azure DevTest Labs from a VHD file using the Azure portal](devtest-lab-create-template.md)
73-
- [Create a custom image in Azure DevTest Labs from a VHD file using PowerShell](devtest-lab-create-custom-image-from-vhd-using-powershell.md)
76+
- Learn how to [create a custom image in Azure DevTest Labs from a VHD file by using the Azure portal](devtest-lab-create-template.md).
77+
- Learn how to [create a custom image in Azure DevTest Labs from a VHD file by using PowerShell](devtest-lab-create-custom-image-from-vhd-using-powershell.md).
Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,59 @@
11
---
2-
title: Upload VHD file to Azure DevTest Labs using PowerShell
3-
description: This article provides a walkthrough that shows you how to upload a VHD file to Azure DevTest Labs using PowerShell.
2+
title: Upload a VHD file to Azure DevTest Labs by using PowerShell
3+
description: Walk through the steps to use PowerShell to upload a VHD file to a lab storage account in Azure DevTest Labs.
44
ms.topic: how-to
55
ms.author: rosemalcolm
66
author: RoseHJM
7-
ms.date: 06/26/2020
7+
ms.date: 12/22/2022
88
---
99

10-
# Upload VHD file to lab's storage account using PowerShell
10+
# Upload a VHD file to a lab storage account by using PowerShell
1111

1212
[!INCLUDE [devtest-lab-upload-vhd-selector](../../includes/devtest-lab-upload-vhd-selector.md)]
1313

14-
In Azure DevTest Labs, VHD files can be used to create custom images, which are used to provision virtual machines.
15-
The following steps walk you through using PowerShell to upload a VHD file to a lab's storage account. Once you've uploaded your VHD file, the [Next steps section](#next-steps) lists some articles that illustrate how to create a custom image from the uploaded VHD file. For more information about disks and VHDs in Azure, see [Introduction to managed disks](../virtual-machines/managed-disks-overview.md)
14+
In this article, learn how to use PowerShell to upload a VHD file to a lab storage account in Azure DevTest Labs. After you upload your VHD file, you can create a custom image from the uploaded VHD file and use the image to provision a virtual machine.
1615

17-
## Step-by-step instructions
16+
For more information about disks and VHDs in Azure, see [Introduction to managed disks](../virtual-machines/managed-disks-overview.md).
1817

19-
The following steps walk you through uploading a VHD file to Azure DevTest Labs using PowerShell.
18+
## Prerequisites
19+
20+
- Download and install the [latest version of PowerShell](/powershell/scripting/install/installing-powershell?).
21+
22+
To upload a VHD file to a lab storage account by using PowerShell, first, get the lab storage account name via the Azure portal. Then, use a PowerShell cmdlet to upload the file.
23+
24+
## Get the lab storage account name
25+
26+
To get the name of the lab storage account:
2027

2128
1. Sign in to the [Azure portal](https://go.microsoft.com/fwlink/p/?LinkID=525040).
2229

23-
1. Select **All services**, and then select **DevTest Labs** from the list.
30+
1. Select **All resources**, and then select your lab.
31+
32+
1. In the lab menu under **Settings**, select **Configuration and policies**.
2433

25-
1. From the list of labs, select the desired lab.
34+
1. In **Activity log**, in the resource menu under **Virtual machine bases**, select **Custom images**.
2635

27-
1. On the lab's blade, select **Configuration**.
36+
1. In **Custom images**, select **Add**.
2837

29-
1. On the lab **Configuration** blade, select **Custom images (VHDs)**.
38+
1. In **Custom image**, under **VHD**, select the **Upload an image using PowerShell** link.
3039

31-
1. On the **Custom images** blade, Select **+Add**.
40+
:::image type="content" source="media/devtest-lab-upload-vhd-using-powershell/upload-image-powershell.png" alt-text="Screenshot that shows the link to upload a VHD by using PowerShell on the Custom image pane.":::
3241

33-
1. On the **Custom image** blade, select **VHD**.
42+
1. In **Upload an image using PowerShell**, select and copy the generated PowerShell script to use in the next section.
3443

35-
1. On the **VHD** blade, select **Upload a VHD using PowerShell**.
44+
## Upload a VHD file
3645

37-
![Upload VHD using PowerShell](./media/devtest-lab-upload-vhd-using-powershell/upload-image-using-psh.png)
46+
To upload a VHD file by using PowerShell:
3847

39-
1. On the **Upload an image using PowerShell** blade, copy the generated PowerShell script to a text editor.
48+
1. In a text editor, paste the generated PowerShell script you copied from the Azure portal.
4049

41-
1. Modify the **LocalFilePath** parameter of the **Add-AzureVhd** cmdlet to point to the location of the VHD file you want to upload.
50+
1. Modify the `-LocalFilePath` parameter of the Add-AzureRmVhd cmdlet to point to the location of the VHD file you want to upload.
4251

43-
1. At a PowerShell prompt, run the **Add-AzureVhd** cmdlet (with the modified **LocalFilePath** parameter).
52+
1. At a PowerShell command prompt, run the Add-AzureRmVhd cmdlet with the modified `-LocalFilePath` parameter.
4453

45-
> [!WARNING]
46-
>
47-
> The process of uploading a VHD file can be lengthy depending on the size of the VHD file and your connection speed.
54+
The process of uploading a VHD file might be lengthy depending on the size of the VHD file and your connection speed.
4855

4956
## Next steps
5057

51-
- [Create a custom image in Azure DevTest Labs from a VHD file using the Azure portal](devtest-lab-create-template.md)
52-
- [Create a custom image in Azure DevTest Labs from a VHD file using PowerShell](devtest-lab-create-custom-image-from-vhd-using-powershell.md)
58+
- Learn how to [create a custom image in Azure DevTest Labs from a VHD file by using the Azure portal](devtest-lab-create-template.md).
59+
- Learn how to [create a custom image in Azure DevTest Labs from a VHD file by using PowerShell](devtest-lab-create-custom-image-from-vhd-using-powershell.md).

0 commit comments

Comments
 (0)