Skip to content

Commit c35e59c

Browse files
authored
Merge pull request #109253 from roygara/updateDirUp
Updates to direct upload articles
2 parents 373697a + 03b3d4e commit c35e59c

File tree

3 files changed

+73
-49
lines changed

3 files changed

+73
-49
lines changed

articles/virtual-machines/linux/disks-upload-vhd-to-managed-disk-cli.md

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,60 @@
11
---
2-
title: Upload a VHD using the Azure CLI
3-
description: Learn how to upload a vhd to an Azure managed disk and copy a managed disk across regions, using the Azure CLI, via direct upload.
2+
title: Upload a VHD to Azure or copy a disk across regions - Azure CLI
3+
description: Learn how to upload a VHD to an Azure managed disk and copy a managed disk across regions, using the Azure CLI, via direct upload.
44
services: "virtual-machines,storage"
55
author: roygara
66
ms.author: rogarana
7-
ms.date: 03/13/2020
7+
ms.date: 03/27/2020
88
ms.topic: article
99
ms.service: virtual-machines
1010
ms.subservice: disks
1111
---
1212

13-
# Upload a vhd to Azure using Azure CLI
13+
# Upload a VHD to Azure or copy a managed disk to another region - Azure CLI
1414

15-
This article explains how to upload a vhd from your local machine to an Azure managed disk. Previously, you had to follow a more involved process that included staging your data in a storage account, and managing that storage account. Now, you no longer need to manage a storage account, or stage data in it to upload a vhd. Instead, you create an empty managed disk, and upload a vhd directly to it. This simplifies uploading on-premises VMs to Azure and enables you to upload a vhd up to 32 TiB directly into a large managed disk.
16-
17-
If you are providing a backup solution for IaaS VMs in Azure, we recommend you use direct upload to restore customer backups to managed disks. If you are uploading a VHD from a machine external to Azure, speeds will depend on your local bandwidth. If you are using an Azure VM, then your bandwidth will be the same as standard HDDs.
18-
19-
Currently, direct upload is supported for standard HDD, standard SSD, and premium SSD managed disks. It is not yet supported for ultra SSDs.
15+
[!INCLUDE [disks-upload-vhd-to-disk-intro](../../../includes/disks-upload-vhd-to-disk-intro.md)]
2016

2117
## Prerequisites
2218

2319
- Download the latest [version of AzCopy v10](../../storage/common/storage-use-azcopy-v10.md#download-and-install-azcopy).
2420
- [Install the Azure CLI](/cli/azure/install-azure-cli).
25-
- A vhd file, stored locally
26-
- If you intend to upload a vhd from on-premises: A fixed size vhd that [has been prepared for Azure](../windows/prepare-for-upload-vhd-image.md), stored locally.
21+
- If you intend to upload a VHD from on-premises: A fixed size VHD that [has been prepared for Azure](../windows/prepare-for-upload-vhd-image.md), stored locally.
2722
- Or, a managed disk in Azure, if you intend to perform a copy action.
2823

29-
## Create an empty managed disk
24+
## Getting started
25+
26+
If you'd prefer to upload disks through a GUI, you can do so using Azure Storage Explorer. For details refer to: [Use Azure Storage Explorer to manage Azure managed disks](disks-use-storage-explorer-managed-disks.md)
3027

31-
To upload your vhd to Azure, you'll need to create an empty managed disk that is configured for this upload process. Before you create one, there's some additional information you should know about these disks.
28+
To upload your VHD to Azure, you'll need to create an empty managed disk that is configured for this upload process. Before you create one, there's some additional information you should know about these disks.
3229

3330
This kind of managed disk has two unique states:
3431

3532
- ReadToUpload, which means the disk is ready to receive an upload but, no [secure access signature](https://docs.microsoft.com/azure/storage/common/storage-dotnet-shared-access-signature-part-1) (SAS) has been generated.
3633
- ActiveUpload, which means that the disk is ready to receive an upload and the SAS has been generated.
3734

38-
While in either of these states, the managed disk will be billed at [standard HDD pricing](https://azure.microsoft.com/pricing/details/managed-disks/), regardless of the actual type of disk. For example, a P10 will be billed as an S10. This will be true until `revoke-access` is called on the managed disk, which is required in order to attach the disk to a VM.
35+
> [!NOTE]
36+
> While in either of these states, the managed disk will be billed at [standard HDD pricing](https://azure.microsoft.com/pricing/details/managed-disks/), regardless of the actual type of disk. For example, a P10 will be billed as an S10. This will be true until `revoke-access` is called on the managed disk, which is required in order to attach the disk to a VM.
3937
40-
Before you can create an empty standard HDD for uploading, you'll need to have the file size of the vhd you want to upload, in bytes. To get that, you can use either `wc -c <yourFileName>.vhd` or `ls -al <yourFileName>.vhd`. This value is used when specifying the **--upload-size-bytes** parameter.
38+
## Create an empty managed disk
39+
40+
Before you can create an empty standard HDD for uploading, you'll need the file size of the VHD you want to upload, in bytes. To get that, you can use either `wc -c <yourFileName>.vhd` or `ls -al <yourFileName>.vhd`. This value is used when specifying the **--upload-size-bytes** parameter.
4141

4242
Create an empty standard HDD for uploading by specifying both the **-–for-upload** parameter and the **--upload-size-bytes** parameter in a [disk create](/cli/azure/disk#az-disk-create) cmdlet:
4343

44+
Replace `<yourdiskname>`, `<yourresourcegroupname>`, `<yourregion>` with values of your choosing. The `--upload-size-bytes` parameter contains an example value of `34359738880`, replace it with a value appropriate for you.
45+
4446
```azurecli
45-
az disk create -n mydiskname -g resourcegroupname -l westus2 --for-upload --upload-size-bytes 34359738880 --sku standard_lrs
47+
az disk create -n <yourdiskname> -g <yourresourcegroupname> -l <yourregion> --for-upload --upload-size-bytes 34359738880 --sku standard_lrs
4648
```
4749

48-
If you would like to upload either a premium SSD or a standard SSD, replace **standard_lrs** with either **premium_LRS** or **standardssd_lrs**. Ultra SSD is not yet supported.
50+
If you would like to upload either a premium SSD or a standard SSD, replace **standard_lrs** with either **premium_LRS** or **standardssd_lrs**. Ultra disks are not supported for now.
4951

50-
You have now created an empty managed disk that is configured for the upload process. To upload a vhd to the disk, you'll need a writeable SAS, so that you can reference it as the destination for your upload.
52+
Now that you've created an empty managed disk that is configured for the upload process, you can upload a VHD to it. To upload a VHD to the disk, you'll need a writeable SAS, so that you can reference it as the destination for your upload.
5153

52-
To generate a writable SAS of your empty managed disk, use the following command:
54+
To generate a writable SAS of your empty managed disk, replace `<yourdiskname>`and `<yourresourcegroupname>`, then use the following command:
5355

5456
```azurecli
55-
az disk grant-access -n mydiskname -g resourcegroupname --access-level Write --duration-in-seconds 86400
57+
az disk grant-access -n <yourdiskname> -g <yourresourcegroupname> --access-level Write --duration-in-seconds 86400
5658
```
5759

5860
Sample returned value:
@@ -63,7 +65,7 @@ Sample returned value:
6365
}
6466
```
6567

66-
## Upload vhd
68+
## Upload a VHD
6769

6870
Now that you have a SAS for your empty managed disk, you can use it to set your managed disk as the destination for your upload command.
6971

@@ -77,8 +79,10 @@ AzCopy.exe copy "c:\somewhere\mydisk.vhd" "sas-URI" --blob-type PageBlob
7779

7880
After the upload is complete, and you no longer need to write any more data to the disk, revoke the SAS. Revoking the SAS will change the state of the managed disk and allow you to attach the disk to a VM.
7981

82+
Replace `<yourdiskname>`and `<yourresourcegroupname>`, then use the following command to make the disk usable:
83+
8084
```azurecli
81-
az disk revoke-access -n mydiskname -g resourcegroupname
85+
az disk revoke-access -n <yourdiskname> -g <yourresourcegroupname>
8286
```
8387

8488
## Copy a managed disk
@@ -116,5 +120,5 @@ az disk revoke-access -n $targetDiskName -g $targetRG
116120

117121
## Next steps
118122

119-
Now that you've successfully uploaded a vhd to a managed disk, you can attach the disk as a [data disk to an existing VM](add-disk.md) or [attach the disk to a VM as an OS disk](upload-vhd.md#create-the-vm), to create a new VM.
123+
Now that you've successfully uploaded a VHD to a managed disk, you can attach the disk as a [data disk to an existing VM](add-disk.md) or [attach the disk to a VM as an OS disk](upload-vhd.md#create-the-vm), to create a new VM.
120124

articles/virtual-machines/windows/disks-upload-vhd-to-managed-disk-powershell.md

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
---
2-
title: Upload a vhd to Azure using Azure PowerShell
3-
description: Learn how to upload a vhd to an Azure managed disk and copy a managed disk across regions, using Azure PowerShell, via direct upload.
2+
title: Upload a VHD to Azure or copy a disk across regions - Azure PowerShell
3+
description: Learn how to upload a VHD to an Azure managed disk and copy a managed disk across regions, using Azure PowerShell, via direct upload.
44
author: roygara
55
ms.author: rogarana
6-
ms.date: 03/13/2020
6+
ms.date: 03/27/2020
77
ms.topic: article
88
ms.service: virtual-machines-linux
99
ms.tgt_pltfrm: linux
1010
ms.subservice: disks
1111
---
1212

13-
# Upload a vhd to Azure using Azure PowerShell
13+
# Upload a VHD to Azure or copy a managed disk to another region - Azure PowerShell
1414

15-
This article explains how to upload a vhd from your local machine to an Azure managed disk. Previously, you had to follow a more involved process that included staging your data in a storage account, and managing that storage account. Now, you no longer need to manage a storage account, or stage data in it to upload a vhd. Instead, you create an empty managed disk, and upload a vhd directly to it. This simplifies uploading on-premises VMs to Azure and enables you to upload a vhd up to 32 TiB directly into a large managed disk.
16-
17-
If you are providing a backup solution for IaaS VMs in Azure, we recommend you use direct upload to restore customer backups to managed disks. If you are uploading a VHD from a machine external to Azure, speeds with depend on your local bandwidth. If you are using an Azure VM, then your bandwidth will be the same as standard HDDs.
18-
19-
Currently, direct upload is supported for standard HDD, standard SSD, and premium SSD managed disks. It is not yet supported for ultra SSDs.
15+
[!INCLUDE [disks-upload-vhd-to-disk-intro](../../../includes/disks-upload-vhd-to-disk-intro.md)]
2016

2117
## Prerequisites
2218

@@ -25,42 +21,49 @@ Currently, direct upload is supported for standard HDD, standard SSD, and premiu
2521
- If you intend to upload a VHD from on-premises: A fixed size VHD that [has been prepared for Azure](prepare-for-upload-vhd-image.md), stored locally.
2622
- Or, a managed disk in Azure, if you intend to perform a copy action.
2723

28-
## Create an empty managed disk
24+
## Getting started
25+
26+
If you'd prefer to upload disks through a GUI, you can do so using Azure Storage Explorer. For details refer to: [Use Azure Storage Explorer to manage Azure managed disks](disks-use-storage-explorer-managed-disks.md)
2927

30-
To upload your vhd to Azure, you'll need to create an empty managed disk that is configured for this upload process. Before you create one, there's some additional information you should know about these disks.
28+
To upload your VHD to Azure, you'll need to create an empty managed disk that is configured for this upload process. Before you create one, there's some additional information you should know about these disks.
3129

3230
This kind of managed disk has two unique states:
3331

3432
- ReadToUpload, which means the disk is ready to receive an upload but, no [secure access signature](https://docs.microsoft.com/azure/storage/common/storage-dotnet-shared-access-signature-part-1) (SAS) has been generated.
3533
- ActiveUpload, which means that the disk is ready to receive an upload and the SAS has been generated.
3634

37-
While in either of these states, the managed disk will be billed at [standard HDD pricing](https://azure.microsoft.com/pricing/details/managed-disks/), regardless of the actual type of disk. For example, a P10 will be billed as an S10. This will be true until `revoke-access` is called on the managed disk, which is required in order to attach the disk to a VM.
35+
> [!NOTE]
36+
> While in either of these states, the managed disk will be billed at [standard HDD pricing](https://azure.microsoft.com/pricing/details/managed-disks/), regardless of the actual type of disk. For example, a P10 will be billed as an S10. This will be true until `revoke-access` is called on the managed disk, which is required in order to attach the disk to a VM.
3837
39-
Before you create an empty standard HDD for uploading, you'll need the file size in bytes of the vhd you want to upload. The example code will get that for you but, to do it yourself you can use: `$vhdSizeBytes = (Get-Item "<fullFilePathHere>").length`. This value is used when specifying the **-UploadSizeInBytes** parameter.
38+
## Create an empty managed disk
39+
40+
Before you can create an empty standard HDD for uploading, you'll need the file size of the VHD you want to upload, in bytes. The example code will get that for you but, to do it yourself you can use: `$vhdSizeBytes = (Get-Item "<fullFilePathHere>").length`. This value is used when specifying the **-UploadSizeInBytes** parameter.
4041

41-
Now, on your local shell, create an empty standard HDD for uploading by specifying the **Upload** setting in the **-CreateOption** parameter as well as the **-UploadSizeInBytes** parameter in the [New-AzDiskConfig](https://docs.microsoft.com/powershell/module/az.compute/new-azdiskconfig?view=azps-1.8.0) cmdlet. Then call [New-AzDisk](https://docs.microsoft.com/powershell/module/az.compute/new-azdisk?view=azps-1.8.0) to create the disk:
42+
Now, on your local shell, create an empty standard HDD for uploading by specifying the **Upload** setting in the **-CreateOption** parameter as well as the **-UploadSizeInBytes** parameter in the [New-AzDiskConfig](https://docs.microsoft.com/powershell/module/az.compute/new-azdiskconfig?view=azps-1.8.0) cmdlet. Then call [New-AzDisk](https://docs.microsoft.com/powershell/module/az.compute/new-azdisk?view=azps-1.8.0) to create the disk.
43+
44+
Replace `<yourdiskname>`, `<yourresourcegroupname>`, and `<yourregion>` then run the following commands:
4245

4346
```powershell
4447
$vhdSizeBytes = (Get-Item "<fullFilePathHere>").length
4548
46-
$diskconfig = New-AzDiskConfig -SkuName 'Standard_LRS' -OsType 'Windows' -UploadSizeInBytes $vhdSizeBytes -Location 'West US' -CreateOption 'Upload'
49+
$diskconfig = New-AzDiskConfig -SkuName 'Standard_LRS' -OsType 'Windows' -UploadSizeInBytes $vhdSizeBytes -Location '<yourregion>' -CreateOption 'Upload'
4750
48-
New-AzDisk -ResourceGroupName 'myResourceGroup' -DiskName 'myDiskName' -Disk $diskconfig
51+
New-AzDisk -ResourceGroupName '<yourresourcegroupname' -DiskName '<yourdiskname>' -Disk $diskconfig
4952
```
5053

51-
If you would like to upload either a premium SSD or a standard SSD, replace **Standard_LRS** with either **Premium_LRS** or **StandardSSD_LRS**. Ultra SSD is not yet supported.
54+
If you would like to upload either a premium SSD or a standard SSD, replace **Standard_LRS** with either **Premium_LRS** or **StandardSSD_LRS**. Ultra disks are not yet supported.
5255

53-
You have now created an empty managed disk that is configured for the upload process. To upload a vhd to the disk, you'll need a writeable SAS, so that you can reference it as the destination for your upload.
56+
Now that you've created an empty managed disk that is configured for the upload process, you can upload a VHD to it. To upload a VHD to the disk, you'll need a writeable SAS, so that you can reference it as the destination for your upload.
5457

55-
To generate a writable SAS of your empty managed disk, use the following command:
58+
To generate a writable SAS of your empty managed disk, replace `<yourdiskname>`and `<yourresourcegroupname>`, then use the following commands:
5659

5760
```powershell
58-
$diskSas = Grant-AzDiskAccess -ResourceGroupName 'myResouceGroup' -DiskName 'myDiskName' -DurationInSecond 86400 -Access 'Write'
61+
$diskSas = Grant-AzDiskAccess -ResourceGroupName '<yourresourcegroupname>' -DiskName '<yourdiskname>' -DurationInSecond 86400 -Access 'Write'
5962
60-
$disk = Get-AzDisk -ResourceGroupName 'myResourceGroup' -DiskName 'myDiskName'
63+
$disk = Get-AzDisk -ResourceGroupName '<yourresourcegroupname>' -DiskName '<yourdiskname>'
6164
```
6265

63-
## Upload vhd
66+
## Upload a VHD
6467

6568
Now that you have a SAS for your empty managed disk, you can use it to set your managed disk as the destination for your upload command.
6669

@@ -74,15 +77,17 @@ AzCopy.exe copy "c:\somewhere\mydisk.vhd" $diskSas.AccessSAS --blob-type PageB
7477

7578
After the upload is complete, and you no longer need to write any more data to the disk, revoke the SAS. Revoking the SAS will change the state of the managed disk and allow you to attach the disk to a VM.
7679

80+
Replace `<yourdiskname>`and `<yourresourcegroupname>`, then run the following command:
81+
7782
```powershell
78-
Revoke-AzDiskAccess -ResourceGroupName 'myResourceGroup' -DiskName 'myDiskName'
83+
Revoke-AzDiskAccess -ResourceGroupName '<yourresourcegroupname>' -DiskName '<yourdiskname>'
7984
```
8085

8186
## Copy a managed disk
8287

83-
Direct upload also simplifies the process of copying a managed disk. You can either copy within the same region or cross-region (to another region).
88+
Direct upload also simplifies the process of copying a managed disk. You can either copy within the same region or copy your managed disk to another region.
8489

85-
The follow script will do this for you, the process is similar to the steps described earlier, with some differences since you're working with an existing disk.
90+
The follow script will do this for you, the process is similar to the steps described earlier, with some differences, since you're working with an existing disk.
8691

8792
> [!IMPORTANT]
8893
> You need to add an offset of 512 when you're providing the disk size in bytes of a managed disk from Azure. This is because Azure omits the footer when returning the disk size. The copy will fail if you do not do this. The following script already does this for you.
@@ -119,6 +124,6 @@ Revoke-AzDiskAccess -ResourceGroupName $targetRG -DiskName $targetDiskName
119124

120125
## Next steps
121126

122-
Now that you've successfully uploaded a vhd to a managed disk, you can attach your disk to a VM and begin using it.
127+
Now that you've successfully uploaded a VHD to a managed disk, you can attach your disk to a VM and begin using it.
123128

124129
To learn how to attach a data disk to a VM, see our article on the subject: [Attach a data disk to a Windows VM with PowerShell](attach-disk-ps.md). To use the disk as the OS disk, see [Create a Windows VM from a specialized disk](create-vm-specialized.md#create-the-new-vm).
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: include file
3+
description: include file
4+
services: virtual-machines
5+
author: roygara
6+
ms.service: virtual-machines
7+
ms.topic: include
8+
ms.date: 03/27/2020
9+
ms.author: rogarana
10+
ms.custom: include file
11+
---
12+
13+
This article explains how to either upload a VHD from your local machine to an Azure managed disk or copy a managed disk to another region, using AzCopy. This process, direct upload, also enables you to upload a VHD up to 32 TiB in size directly into a managed disk. Currently, direct upload is supported for standard HDD, standard SSD, and premium SSD managed disks. It isn't supported for ultra disks, yet.
14+
15+
If you're providing a backup solution for IaaS VMs in Azure, we recommend using direct upload to restore customer backups to managed disks. When uploading a VHD from a source external to Azure, speeds would depend on your local bandwidth. When uploading or copying from an Azure VM, then your bandwidth would be the same as standard HDDs.

0 commit comments

Comments
 (0)