You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| 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*|
79
79
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.
81
81
82
82
### Extensions
83
83
VM [extensions](extensions-features.md?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) give your VM additional capabilities through post deployment configuration and automated tasks.
Copy file name to clipboardExpand all lines: articles/virtual-machines/windows/upload-generalized-managed.md
+26-25Lines changed: 26 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,14 @@
1
1
---
2
-
title: Create a managed Azure VM from a generalized on-premises VHD
2
+
title: Create a VM from an uploaded generalized VHD
3
3
description: Upload a generalized VHD to Azure and use it to create new VMs, in the Resource Manager deployment model.
4
4
services: virtual-machines-windows
5
-
documentationcenter: ''
6
5
author: cynthn
7
-
manager: gwallace
8
-
editor: ''
9
6
tags: azure-resource-manager
10
7
11
-
ms.assetid:
12
8
ms.service: virtual-machines-windows
13
9
ms.workload: infrastructure-services
14
-
ms.tgt_pltfrm: vm-windows
15
-
16
10
ms.topic: article
17
-
ms.date: 09/25/2018
11
+
ms.date: 12/12/2019
18
12
ms.author: cynthn
19
13
---
20
14
@@ -30,11 +24,9 @@ For a sample script, see [Sample script to upload a VHD to Azure and create a ne
30
24
- 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).
31
25
32
26
33
-
34
-
35
27
## Generalize the source VM by using Sysprep
36
28
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).
38
30
39
31
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).
40
32
@@ -53,41 +45,50 @@ Make sure the server roles running on the machine are supported by Sysprep. For
53
45
6. When Sysprep finishes, it shuts down the virtual machine. Do not restart the VM.
54
46
55
47
56
-
## Upload the VHD to your storage account
48
+
## Upload the VHD
57
49
58
50
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).
59
51
60
52
61
-
## Create a managed image from the uploaded VHD
62
53
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.
Create a managed image from your generalized OS managed disk. Replace the following values with your own information.
65
62
66
-
First, set some parameters:
63
+
First, set some variables:
67
64
68
65
```powershell
69
-
$location = "East US"
70
-
$imageName = "myImage"
66
+
$location = 'East US'
67
+
$imageName = 'myImage'
68
+
$rgName = 'myResourceGroup'
71
69
```
72
70
73
-
Create the image using your generalized OS VHD.
71
+
Create the image using your managed disk.
74
72
75
-
```powershell
73
+
```azurepowershell-interactive
76
74
$imageConfig = New-AzImageConfig `
77
75
-Location $location
78
76
$imageConfig = Set-AzImageOsDisk `
79
77
-Image $imageConfig `
80
-
-OsType Windows `
81
78
-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 `
85
87
-ImageName $imageName `
86
88
-ResourceGroupName $rgName `
87
89
-Image $imageConfig
88
90
```
89
91
90
-
91
92
## Create the VM
92
93
93
94
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
0 commit comments