Skip to content

Commit 9edd5c0

Browse files
authored
Merge pull request #98865 from cynthn/upload-disk
Changes for upload straight to MD
2 parents 93f85dc + 8b7fe7f commit 9edd5c0

File tree

3 files changed

+28
-27
lines changed

3 files changed

+28
-27
lines changed

articles/virtual-machines/windows/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ This table shows some ways that you can find the information for an image.
7777
| REST APIs |[List image publishers](https://docs.microsoft.com/rest/api/compute/platformimages/platformimages-list-publishers)<BR>[List image offers](https://docs.microsoft.com/rest/api/compute/platformimages/platformimages-list-publisher-offers)<BR>[List image skus](https://docs.microsoft.com/rest/api/compute/platformimages/platformimages-list-publisher-offer-skus) |
7878
| Azure CLI |[az vm image list-publishers](https://docs.microsoft.com/cli/azure/vm/image?view=azure-cli-latest) --location *location*<BR>[az vm image list-offers](https://docs.microsoft.com/cli/azure/vm/image?view=azure-cli-latest) --location *location* --publisher *publisherName*<BR>[az vm image list-skus](https://docs.microsoft.com/cli/azure/vm?view=azure-cli-latest) --location *location* --publisher *publisherName* --offer *offerName*|
7979

80-
You can choose to [upload and use your own image](upload-generalized-managed.md#upload-the-vhd-to-your-storage-account) and when you do, the publisher name, offer, and sku aren’t used.
80+
You can choose to [upload and use your own image](upload-generalized-managed.md) and when you do, the publisher name, offer, and sku aren’t used.
8181

8282
### Extensions
8383
VM [extensions](extensions-features.md?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) give your VM additional capabilities through post deployment configuration and automated tasks.

articles/virtual-machines/windows/tutorial-custom-images.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ This example creates a VM named *myVMfromImage* from the *myImage* image, in *my
122122
New-AzVm `
123123
-ResourceGroupName "myResourceGroup" `
124124
-Name "myVMfromImage" `
125-
-ImageName "myImage" `
125+
-ImageName "myImage" `
126126
-Location "East US" `
127127
-VirtualNetworkName "myImageVnet" `
128128
-SubnetName "myImageSubnet" `

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

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
---
2-
title: Create a managed Azure VM from a generalized on-premises VHD
2+
title: Create a VM from an uploaded generalized VHD
33
description: Upload a generalized VHD to Azure and use it to create new VMs, in the Resource Manager deployment model.
44
services: virtual-machines-windows
5-
documentationcenter: ''
65
author: cynthn
7-
manager: gwallace
8-
editor: ''
96
tags: azure-resource-manager
107

11-
ms.assetid:
128
ms.service: virtual-machines-windows
139
ms.workload: infrastructure-services
14-
ms.tgt_pltfrm: vm-windows
15-
1610
ms.topic: article
17-
ms.date: 09/25/2018
11+
ms.date: 12/12/2019
1812
ms.author: cynthn
1913
---
2014

@@ -30,11 +24,9 @@ For a sample script, see [Sample script to upload a VHD to Azure and create a ne
3024
- Review [Plan for the migration to Managed Disks](on-prem-to-azure.md#plan-for-the-migration-to-managed-disks) before starting your migration to [Managed Disks](managed-disks-overview.md).
3125

3226

33-
34-
3527
## Generalize the source VM by using Sysprep
3628

37-
Sysprep removes all your personal account information, among other things, and prepares the machine to be used as an image. For details about Sysprep, see the [Sysprep Overview](https://docs.microsoft.com/windows-hardware/manufacture/desktop/sysprep--system-preparation--overview).
29+
If you haven't already, you need to Sysprep the VM before uploading the VHD to Azure. Sysprep removes all your personal account information, among other things, and prepares the machine to be used as an image. For details about Sysprep, see the [Sysprep Overview](https://docs.microsoft.com/windows-hardware/manufacture/desktop/sysprep--system-preparation--overview).
3830

3931
Make sure the server roles running on the machine are supported by Sysprep. For more information, see [Sysprep Support for Server Roles](https://msdn.microsoft.com/windows/hardware/commercialize/manufacture/desktop/sysprep-support-for-server-roles).
4032

@@ -53,41 +45,50 @@ Make sure the server roles running on the machine are supported by Sysprep. For
5345
6. When Sysprep finishes, it shuts down the virtual machine. Do not restart the VM.
5446

5547

56-
## Upload the VHD to your storage account
48+
## Upload the VHD
5749

5850
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).
5951

6052

61-
## Create a managed image from the uploaded VHD
6253

63-
Create a managed image from your generalized OS managed disk. Replace the following values with your own information.
54+
Once the VHD is uploaded to the managed disk, you need to use [Get-AzDisk](https://docs.microsoft.com/powershell/module/az.compute/get-azdisk) to get the managed disk.
6455

56+
```azurepowershell-interactive
57+
$disk = Get-AzDisk -ResourceGroupName 'myResourceGroup' -DiskName 'myDiskName'
58+
```
59+
60+
## Create the image
61+
Create a managed image from your generalized OS managed disk. Replace the following values with your own information.
6562

66-
First, set some parameters:
63+
First, set some variables:
6764

6865
```powershell
69-
$location = "East US"
70-
$imageName = "myImage"
66+
$location = 'East US'
67+
$imageName = 'myImage'
68+
$rgName = 'myResourceGroup'
7169
```
7270

73-
Create the image using your generalized OS VHD.
71+
Create the image using your managed disk.
7472

75-
```powershell
73+
```azurepowershell-interactive
7674
$imageConfig = New-AzImageConfig `
7775
-Location $location
7876
$imageConfig = Set-AzImageOsDisk `
7977
-Image $imageConfig `
80-
-OsType Windows `
8178
-OsState Generalized `
82-
-BlobUri $urlOfUploadedImageVhd `
83-
-DiskSizeGB 20
84-
New-AzImage `
79+
-OsType Windows `
80+
-ManagedDiskId $disk.Id
81+
```
82+
83+
Create the image.
84+
85+
```azurepowershell-interactive
86+
$image = New-AzImage `
8587
-ImageName $imageName `
8688
-ResourceGroupName $rgName `
8789
-Image $imageConfig
8890
```
8991

90-
9192
## Create the VM
9293

9394
Now that you have an image, you can create one or more new VMs from the image. This example creates a VM named *myVM* from *myImage*, in *myResourceGroup*.
@@ -97,7 +98,7 @@ Now that you have an image, you can create one or more new VMs from the image. T
9798
New-AzVm `
9899
-ResourceGroupName $rgName `
99100
-Name "myVM" `
100-
-ImageName $imageName `
101+
-Image $image.Id `
101102
-Location $location `
102103
-VirtualNetworkName "myVnet" `
103104
-SubnetName "mySubnet" `

0 commit comments

Comments
 (0)