Skip to content

Commit 43494fe

Browse files
authored
Merge pull request #91341 from cynthn/upload
New upload stuffs
2 parents b8a5fd0 + 6396530 commit 43494fe

File tree

4 files changed

+18
-251
lines changed

4 files changed

+18
-251
lines changed

articles/virtual-machines/linux/capture-image.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ To create a copy of your existing Linux VM for backup or debugging, or to upload
2828

2929
You can use the **Azure VM Image Builder (Public Preview)** service to build your custom image, no need to learn any tools, or setup build pipelines, simply providing an image configuration, and the Image Builder will create the Image. For more information, see [Getting Started with Azure VM Image Builder](https://docs.microsoft.com/azure/virtual-machines/linux/image-builder-overview).
3030

31-
Additonally, use **Packer** to create your custom configuration. For more information, see [How to use Packer to create Linux virtual machine images in Azure](build-image-with-packer.md).
32-
3331
You'll need the following items before creating an image:
3432

3533
* An Azure VM created in the Resource Manager deployment model that uses managed disks. If you haven't yet created a Linux VM, you can use the [portal](quick-create-portal.md), the [Azure CLI](quick-create-cli.md), or [Resource Manager templates](create-ssh-secured-vm-from-template.md). Configure the VM as needed. For example, [add data disks](add-disk.md), apply updates, and install applications.

articles/virtual-machines/linux/upload-vhd.md

Lines changed: 12 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ms.workload: infrastructure-services
1414
ms.tgt_pltfrm: vm-linux
1515
ms.devlang: azurecli
1616
ms.topic: article
17-
ms.date: 10/17/2018
17+
ms.date: 10/10/2019
1818
ms.author: cynthn
1919

2020
---
@@ -30,32 +30,24 @@ You have two options to create a custom disk:
3030
* Upload a VHD
3131
* Copy an existing Azure VM
3232

33-
## Quick commands
34-
35-
When creating a new VM with [az vm create](/cli/azure/vm#az-vm-create) from a customized or specialized disk, you **attach** the disk (--attach-os-disk) rather than specifying a custom or marketplace image (--image). The following example creates a VM named *myVM* using the managed disk named *myManagedDisk* created from your customized VHD:
36-
37-
```azurecli
38-
az vm create --resource-group myResourceGroup --location eastus --name myVM \
39-
--os-type linux --attach-os-disk myManagedDisk
40-
```
4133

4234
## Requirements
4335
To complete the following steps, you'll need:
4436

45-
* A Linux virtual machine that has been prepared for use in Azure. The [Prepare the VM](#prepare-the-vm) section of this article covers how to find distro-specific information on installing the Azure Linux Agent (waagent), which is needed for you to connect to a VM with SSH.
46-
* The VHD file from an existing [Azure-endorsed Linux distribution](endorsed-distros.md?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) (or see [information for non-endorsed distributions](create-upload-generic.md?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)) to a virtual disk in the VHD format. Multiple tools exist to create a VM and VHD:
47-
* Install and configure [QEMU](https://en.wikibooks.org/wiki/QEMU/Installing_QEMU) or [KVM](https://www.linux-kvm.org/page/RunningKVM), taking care to use VHD as your image format. If needed, you can [convert an image](https://en.wikibooks.org/wiki/QEMU/Images#Converting_image_formats) with `qemu-img convert`.
48-
* You can also use Hyper-V [on Windows 10](https://msdn.microsoft.com/virtualization/hyperv_on_windows/quick_start/walkthrough_install) or [on Windows Server 2012/2012 R2](https://technet.microsoft.com/library/hh846766.aspx).
37+
- A Linux virtual machine that has been prepared for use in Azure. The [Prepare the VM](#prepare-the-vm) section of this article covers how to find distro-specific information on installing the Azure Linux Agent (waagent), which is needed for you to connect to a VM with SSH.
38+
- The VHD file from an existing [Azure-endorsed Linux distribution](endorsed-distros.md?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) (or see [information for non-endorsed distributions](create-upload-generic.md?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)) to a virtual disk in the VHD format. Multiple tools exist to create a VM and VHD:
39+
- Install and configure [QEMU](https://en.wikibooks.org/wiki/QEMU/Installing_QEMU) or [KVM](https://www.linux-kvm.org/page/RunningKVM), taking care to use VHD as your image format. If needed, you can [convert an image](https://en.wikibooks.org/wiki/QEMU/Images#Converting_image_formats) with `qemu-img convert`.
40+
- You can also use Hyper-V [on Windows 10](https://msdn.microsoft.com/virtualization/hyperv_on_windows/quick_start/walkthrough_install) or [on Windows Server 2012/2012 R2](https://technet.microsoft.com/library/hh846766.aspx).
4941

5042
> [!NOTE]
5143
> The newer VHDX format is not supported in Azure. When you create a VM, specify VHD as the format. If needed, you can convert VHDX disks to VHD with [qemu-img convert](https://en.wikibooks.org/wiki/QEMU/Images#Converting_image_formats) or the [Convert-VHD](https://technet.microsoft.com/library/hh848454.aspx) PowerShell cmdlet. Azure does not support uploading dynamic VHDs, so you'll need to convert such disks to static VHDs before uploading. You can use tools such as [Azure VHD Utilities for GO](https://github.com/Microsoft/azure-vhd-utils-for-go) to convert dynamic disks during the process of uploading them to Azure.
5244
>
5345
>
5446
5547

56-
* Make sure that you have the latest [Azure CLI](/cli/azure/install-az-cli2) installed and you are signed in to an Azure account with [az login](/cli/azure/reference-index#az-login).
48+
- Make sure that you have the latest [Azure CLI](/cli/azure/install-az-cli2) installed and you are signed in to an Azure account with [az login](/cli/azure/reference-index#az-login).
5749

58-
In the following examples, replace example parameter names with your own values, such as *myResourceGroup*, *mystorageaccount*, and *mydisks*.
50+
In the following examples, replace example parameter names with your own values, such as `myResourceGroup`, `mystorageaccount`, and `mydisks`.
5951

6052
<a id="prepimage"> </a>
6153

@@ -80,98 +72,16 @@ Also see the [Linux Installation Notes](create-upload-generic.md#general-linux-i
8072
8173
## Option 1: Upload a VHD
8274

83-
You can upload a customized VHD that you have running on a local machine or that you exported from another cloud. To use a VHD to create a new Azure VM, you'll need to upload the VHD to a storage account and create a managed disk from the VHD. For more information, see [Azure Managed Disks overview](../windows/managed-disks-overview.md).
84-
85-
### Create a resource group
86-
87-
Before uploading your custom disk and creating VMs, you'll need to create a resource group with [az group create](/cli/azure/group#az-group-create).
88-
89-
The following example creates a resource group named *myResourceGroup* in the *eastus* location:
90-
91-
```azurecli
92-
az group create \
93-
--name myResourceGroup \
94-
--location eastus
95-
```
96-
97-
### Create a storage account
98-
99-
Create a storage account for your custom disk and VMs with [az storage account create](/cli/azure/storage/account). The following example creates a storage account named *mystorageaccount* in the resource group previously created:
100-
101-
```azurecli
102-
az storage account create \
103-
--resource-group myResourceGroup \
104-
--location eastus \
105-
--name mystorageaccount \
106-
--kind Storage \
107-
--sku Standard_LRS
108-
```
109-
110-
### List storage account keys
111-
Azure generates two 512-bit access keys for each storage account. These access keys are used when authenticating to the storage account, such as when carrying out write operations. For more information, see [managing access to storage](../../storage/common/storage-account-manage.md#access-keys).
112-
113-
You view the access keys with [az storage account keys list](/cli/azure/storage/account/keys#az-storage-account-keys-list). For example, to view the access keys for the storage account you created:
114-
115-
```azurecli
116-
az storage account keys list \
117-
--resource-group myResourceGroup \
118-
--account-name mystorageaccount
119-
```
120-
121-
The output is similar to:
75+
You can now upload VHD straight into a managed disk. For instructions, see [Upload a VHD to Azure using Azure CLI](disks-upload-vhd-to-managed-disk-cli.md).
12276

123-
```azurecli
124-
info: Executing command storage account keys list
125-
+ Getting storage account keys
126-
data: Name Key Permissions
127-
data: ---- ---------------------------------------------------------------------------------------- -----------
128-
data: key1 d4XAvZzlGAgWdvhlWfkZ9q4k9bYZkXkuPCJ15NTsQOeDeowCDAdB80r9zA/tUINApdSGQ94H9zkszYyxpe8erw== Full
129-
data: key2 Ww0T7g4UyYLaBnLYcxIOTVziGAAHvU+wpwuPvK4ZG0CDFwu/mAxS/YYvAQGHocq1w7/3HcalbnfxtFdqoXOw8g== Full
130-
info: storage account keys list command OK
131-
```
132-
Make a note of **key1** as you will use it to interact with your storage account in the next steps.
133-
134-
### Create a storage container
135-
In the same way that you create different directories to logically organize your local file system, you'll create containers within a storage account to organize your disks. A storage account can contain many containers. Create a container with [az storage container create](/cli/azure/storage/container#az-storage-container-create).
136-
137-
The following example creates a container named *mydisks*:
138-
139-
```azurecli
140-
az storage container create \
141-
--account-name mystorageaccount \
142-
--name mydisks
143-
```
144-
145-
### Upload the VHD
146-
Upload your custom disk with [az storage blob upload](/cli/azure/storage/blob#az-storage-blob-upload). You'll upload and store your custom disk as a page blob.
147-
148-
Specify your access key, the container you created in the previous step, and then the path to the custom disk on your local computer:
149-
150-
```azurecli
151-
az storage blob upload --account-name mystorageaccount \
152-
--account-key key1 \
153-
--container-name mydisks \
154-
--type page \
155-
--file /path/to/disk/mydisk.vhd \
156-
--name myDisk.vhd
157-
```
158-
Uploading the VHD may take a while.
159-
160-
### Create a managed disk
161-
162-
163-
Create a managed disk from the VHD with [az disk create](/cli/azure/disk#az-disk-create). The following example creates a managed disk named *myManagedDisk* from the VHD you uploaded to your named storage account and container:
164-
165-
```azurecli
166-
az disk create \
167-
--resource-group myResourceGroup \
168-
--name myManagedDisk \
169-
--source https://mystorageaccount.blob.core.windows.net/mydisks/myDisk.vhd
170-
```
17177
## Option 2: Copy an existing VM
17278

17379
You can also create a customized VM in Azure and then copy the OS disk and attach it to a new VM to create another copy. This is fine for testing, but if you want to use an existing Azure VM as the model for multiple new VMs, create an *image* instead. For more information about creating an image from an existing Azure VM, see [Create a custom image of an Azure VM by using the CLI](tutorial-custom-images.md).
17480

81+
If you want to copy an existing VM to another region, you might want to use azcopy to [creat a copy of a disk in another region](disks-upload-vhd-to-managed-disk-cli.md#copy-a-managed-disk).
82+
83+
Otherwise, you should take a snapshot of the VM and then create a new OS VHD from the snapshot.
84+
17585
### Create a snapshot
17686

17787
This example creates a snapshot of a VM named *myVM* in resource group *myResourceGroup* and creates a snapshot named *osDiskSnapshot*.

articles/virtual-machines/windows/create-vm-specialized.md

Lines changed: 4 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
title: Create a Windows VM from a specialized VHD in Azure | Microsoft Docs
33
description: Create a new Windows VM by attaching a specialized managed disk as the OS disk by using the Resource Manager deployment model.
44
services: virtual-machines-windows
5-
documentationcenter: ''
65
author: cynthn
76
manager: gwallace
87
editor: ''
@@ -12,9 +11,8 @@ ms.assetid: 3b7d3cd5-e3d7-4041-a2a7-0290447458ea
1211
ms.service: virtual-machines-windows
1312
ms.workload: infrastructure-services
1413
ms.tgt_pltfrm: vm-windows
15-
1614
ms.topic: article
17-
ms.date: 10/10/2018
15+
ms.date: 10/10/2019
1816
ms.author: cynthn
1917

2018
---
@@ -60,100 +58,15 @@ Use the VHD as-is to create a new VM.
6058
* Make sure the VM is configured to get the IP address and DNS settings from DHCP. This ensures that the server obtains an IP address within the virtual network when it starts up.
6159

6260

63-
### Get the storage account
64-
You'll need a storage account in Azure to store the uploaded VHD. You can either use an existing storage account or create a new one.
65-
66-
Show the available storage accounts.
67-
68-
```powershell
69-
Get-AzStorageAccount
70-
```
71-
72-
To use an existing storage account, proceed to the [Upload the VHD](#upload-the-vhd-to-your-storage-account) section.
73-
74-
Create a storage account.
75-
76-
1. You'll need the name of the resource group where the storage account will be created. Use Get-AzResourceGroup see all the resource groups that are in your subscription.
77-
78-
```powershell
79-
Get-AzResourceGroup
80-
```
81-
82-
Create a resource group named *myResourceGroup* in the *West US* region.
83-
84-
```powershell
85-
New-AzResourceGroup `
86-
-Name myResourceGroup `
87-
-Location "West US"
88-
```
89-
90-
2. Create a storage account named *mystorageaccount* in the new resource group by using the [New-AzStorageAccount](https://docs.microsoft.com/powershell/module/az.storage/new-azstorageaccount) cmdlet.
91-
92-
```powershell
93-
New-AzStorageAccount `
94-
-ResourceGroupName myResourceGroup `
95-
-Name mystorageaccount `
96-
-Location "West US" `
97-
-SkuName "Standard_LRS" `
98-
-Kind "Storage"
99-
```
100-
101-
### Upload the VHD to your storage account
102-
Use the [Add-AzVhd](https://docs.microsoft.com/powershell/module/az.compute/add-azvhd) cmdlet to upload the VHD to a container in your storage account. This example uploads the file *myVHD.vhd* from "C:\Users\Public\Documents\Virtual hard disks\" to a storage account named *mystorageaccount* in the *myResourceGroup* resource group. The file is stored in the container named *mycontainer* and the new file name will be *myUploadedVHD.vhd*.
103-
104-
```powershell
105-
$resourceGroupName = "myResourceGroup"
106-
$urlOfUploadedVhd = "https://mystorageaccount.blob.core.windows.net/mycontainer/myUploadedVHD.vhd"
107-
Add-AzVhd -ResourceGroupName $resourceGroupName `
108-
-Destination $urlOfUploadedVhd `
109-
-LocalFilePath "C:\Users\Public\Documents\Virtual hard disks\myVHD.vhd"
110-
```
61+
### Upload the VHD
11162

112-
113-
If the commands are successful, you'll get a response that looks similar to this:
114-
115-
```powershell
116-
MD5 hash is being calculated for the file C:\Users\Public\Documents\Virtual hard disks\myVHD.vhd.
117-
MD5 hash calculation is completed.
118-
Elapsed time for the operation: 00:03:35
119-
Creating new page blob of size 53687091712...
120-
Elapsed time for upload: 01:12:49
121-
122-
LocalFilePath DestinationUri
123-
------------- --------------
124-
C:\Users\Public\Doc... https://mystorageaccount.blob.core.windows.net/mycontainer/myUploadedVHD.vhd
125-
```
126-
127-
This command may take a while to complete, depending on your network connection and the size of your VHD file.
128-
129-
### Create a managed disk from the VHD
130-
131-
Create a managed disk from the specialized VHD in your storage account by using [New-AzDisk](https://docs.microsoft.com/powershell/module/az.compute/new-azdisk). This example uses *myOSDisk1* for the disk name, puts the disk in *Standard_LRS* storage, and uses *https://storageaccount.blob.core.windows.net/vhdcontainer/osdisk.vhd* as the URI for the source VHD.
132-
133-
Create a new resource group for the new VM.
134-
135-
```powershell
136-
$destinationResourceGroup = 'myDestinationResourceGroup'
137-
New-AzResourceGroup -Location $location `
138-
-Name $destinationResourceGroup
139-
```
140-
141-
Create the new OS disk from the uploaded VHD.
142-
143-
```powershell
144-
$sourceUri = 'https://storageaccount.blob.core.windows.net/vhdcontainer/osdisk.vhd'
145-
$osDiskName = 'myOsDisk'
146-
$osDisk = New-AzDisk -DiskName $osDiskName -Disk `
147-
(New-AzDiskConfig -AccountType Standard_LRS `
148-
-Location $location -CreateOption Import `
149-
-SourceUri $sourceUri) `
150-
-ResourceGroupName $destinationResourceGroup
151-
```
63+
You can now upload a VHD straight into a managed disk. For instructions, see [Upload a VHD to Azure using Azure PowerShell](disks-upload-vhd-to-managed-disk-powershell.md).
15264

15365
## Option 3: Copy an existing Azure VM
15466

15567
You can create a copy of a VM that uses managed disks by taking a snapshot of the VM, and then by using that snapshot to create a new managed disk and a new VM.
15668

69+
If you want to copy an existing VM to another region, you might want to use azcopy to [creat a copy of a disk in another region](disks-upload-vhd-to-managed-disk-powershell.md#copy-a-managed-disk).
15770

15871
### Take a snapshot of the OS disk
15972

articles/virtual-machines/windows/upload-generalized-managed.md

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -53,68 +53,14 @@ Make sure the server roles running on the machine are supported by Sysprep. For
5353
6. When Sysprep finishes, it shuts down the virtual machine. Do not restart the VM.
5454

5555

56-
## Get a storage account
57-
58-
You'll need a storage account in Azure to store the uploaded VM image. You can either use an existing storage account or create a new one.
59-
60-
If you'll be using the VHD to create a managed disk for a VM, the storage account location must be the same location where you'll be creating the VM.
61-
62-
To show the available storage accounts, enter:
63-
64-
```azurepowershell
65-
Get-AzStorageAccount | Format-Table
66-
```
67-
6856
## Upload the VHD to your storage account
6957

70-
Use the [Add-AzVhd](https://docs.microsoft.com/powershell/module/az.compute/add-azvhd) cmdlet to upload the VHD to a container in your storage account. This example uploads the file *myVHD.vhd* from *C:\Users\Public\Documents\Virtual hard disks\\* to a storage account named *mystorageaccount* in the *myResourceGroup* resource group. The file will be placed into the container named *mycontainer* and the new file name will be *myUploadedVHD.vhd*.
71-
72-
```powershell
73-
$rgName = "myResourceGroup"
74-
$urlOfUploadedImageVhd = "https://mystorageaccount.blob.core.windows.net/mycontainer/myUploadedVHD.vhd"
75-
Add-AzVhd -ResourceGroupName $rgName -Destination $urlOfUploadedImageVhd `
76-
-LocalFilePath "C:\Users\Public\Documents\Virtual hard disks\myVHD.vhd"
77-
```
78-
79-
80-
If successful, you get a response that looks similar to this:
81-
82-
```powershell
83-
MD5 hash is being calculated for the file C:\Users\Public\Documents\Virtual hard disks\myVHD.vhd.
84-
MD5 hash calculation is completed.
85-
Elapsed time for the operation: 00:03:35
86-
Creating new page blob of size 53687091712...
87-
Elapsed time for upload: 01:12:49
88-
89-
LocalFilePath DestinationUri
90-
------------- --------------
91-
C:\Users\Public\Doc... https://mystorageaccount.blob.core.windows.net/mycontainer/myUploadedVHD.vhd
92-
```
93-
94-
Depending on your network connection and the size of your VHD file, this command may take a while to complete.
95-
96-
### Other options for uploading a VHD
97-
98-
You can also upload a VHD to your storage account using one of the following:
99-
100-
- [AzCopy](https://aka.ms/downloadazcopy)
101-
- [Azure Storage Copy Blob API](https://msdn.microsoft.com/library/azure/dd894037.aspx)
102-
- [Azure Storage Explorer Uploading Blobs](https://azurestorageexplorer.codeplex.com/)
103-
- [Storage Import/Export Service REST API Reference](https://msdn.microsoft.com/library/dn529096.aspx)
104-
- We recommend using the Import/Export Service if estimated uploading time is longer than seven days. You can use [DataTransferSpeedCalculator](https://github.com/Azure-Samples/storage-dotnet-import-export-job-management/blob/master/DataTransferSpeedCalculator.html) to estimate the time from data size and transfer unit.
105-
Import/Export can be used to copy to a standard storage account. You'll need to copy from standard storage to premium storage account by using a tool like AzCopy.
106-
107-
> [!IMPORTANT]
108-
> If you are using AzCopy to upload your VHD to Azure, make sure you have set [**/BlobType:page**](https://docs.microsoft.com/azure/storage/common/storage-use-azcopy-blobs#upload-a-file) before running your upload script.
109-
> If the destination is a blob and this option is not specified, by default AzCopy creates a block blob.
110-
>
111-
>
112-
58+
You can now upload a VHD straight into a managed disk. For instructions, see [Upload a VHD to Azure using Azure PowerShell](disks-upload-vhd-to-managed-disk-powershell.md).
11359

11460

11561
## Create a managed image from the uploaded VHD
11662

117-
Create a managed image from your generalized OS VHD. Replace the following values with your own information.
63+
Create a managed image from your generalized OS managed disk. Replace the following values with your own information.
11864

11965

12066
First, set some parameters:

0 commit comments

Comments
 (0)