Skip to content

Commit 827cd6a

Browse files
committed
combining
1 parent 9d8d3ad commit 827cd6a

File tree

4 files changed

+75
-44
lines changed

4 files changed

+75
-44
lines changed

articles/virtual-machines/.openpublishing.redirection.virtual-machines.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@
2020
"redirect_url": "/azure-resource-manager/management/move-resource-group-and-subscription#use-azure-cli",
2121
"redirect_document_id": false
2222
},
23+
{
24+
"source_path_from_root": "/articles/virtual-machines/windows/create-vm-specialized-portal.md",
25+
"redirect_url": "/azure/virtual-machines/attach-os-disk",
26+
"redirect_document_id": false
27+
},
28+
{
29+
"source_path_from_root": "/articles/virtual-machines/windows/create-vm-specialized.md",
30+
"redirect_url": "/azure/virtual-machines/attach-os-disk",
31+
"redirect_document_id": false
32+
},
2333
{
2434
"source_path_from_root": "/articles/virtual-machines/windows/move-vm.md",
2535
"redirect_url": "/azure-resource-manager/management/move-resource-group-and-subscription",

articles/virtual-machines/TOC.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -796,17 +796,14 @@
796796
href: ./linux/tutorial-secure-web-server.md
797797
- name: Windows
798798
items:
799-
- name: Specialized disk - Portal
800-
displayName: Create VM, Create
801-
href: ./windows/create-vm-specialized-portal.md
802-
- name: Specialized disk - PowerShell
803-
displayName: Create VM, Create
804-
href: ./windows/create-vm-specialized.md
805799
- name: ARM template
806800
displayName: Create VM, Create, ARM
807801
href: ./windows/ps-template.md
808802
- name: Secure web server with TLS\SSL
809803
href: ./windows/tutorial-secure-web-server.md
804+
- name: Create from an existing OS disk or VHD
805+
displayName: attach
806+
href: attach-os-disk.md
810807
- name: Delete a VM and its resources
811808
href: delete.md
812809
- name: Connect to Virtual Machines

articles/virtual-machines/windows/create-vm-specialized.md renamed to articles/virtual-machines/attach-os-disk.md

Lines changed: 57 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
title: Attach an OS disk to a VM
2+
title: Attach an existing OS disk to a VM
33
description: Create a new Windows VM by attaching a specialized OS disk.
44
author: cynthn
55
ms.service: virtual-machines
66
ms.workload: infrastructure-services
77
ms.topic: how-to
8-
ms.date: 03/08/2023
8+
ms.date: 03/30/2023
99
ms.author: cynthn
1010
ms.custom: devx-track-azurepowershell
1111

@@ -16,19 +16,63 @@ ms.custom: devx-track-azurepowershell
1616

1717
Create a new VM by attaching an existing OS disk to a new VM. This option is useful if you have a VM that isn't working correctly. You can delete the VM and then reuse the disk to create a new VM.
1818

19-
20-
You can also use the Azure portal to [create a new VM from an existing disk](create-vm-specialized-portal.md).
21-
22-
2319
> [!IMPORTANT]
24-
>
20+
>
2521
> Creating an image instead of just attaching a disk means you can create multiple VMs from the same source disk.
2622
> When you use a specialized disk to create a new VM, the new VM retains the computer name of the original VM. Other computer-specific information (e.g. CMID) is also kept and, in some cases, this duplicate information could cause issues. When copying a VM, be aware of what types of computer-specific information your applications rely on.
2723
>
2824
> You can also use the VHD as a source to create an Azure Compute Gallery image. For more information, see [Create an image definition and image version](../image-version.md). Customers are encouraged to use Azure Compute Gallery as all new features like ARM64, Trusted Launch, and Confidential VM,are only supported through Azure Compute Gallery.  
2925
3026
We recommend that you limit the number of concurrent deployments to 20 VMs from a single VHD or snapshot.
31-
## Get an existing disk
27+
28+
29+
### [Portal](#tab/portal)
30+
31+
32+
Create a snapshot and then create a disk from the snapshot. This strategy allows you to keep the original VHD as a fallback:
33+
34+
1. Open the [Azure portal](https://portal.azure.com).
35+
2. In the search box, enter **disks** and then select **Disks** to display the list of available disks.
36+
3. Select the disk that you would like to use. The **Disk** page for that disk appears.
37+
4. From the menu at the top, select **Create snapshot**.
38+
5. Choose a **Resource group** for the snapshot. You can use either an existing resource group or create a new one.
39+
6. Enter a **Name** for the snapshot.
40+
7. For **Snapshot type**, choose **Full**.
41+
8. For **Storage type**, choose **Standard HDD**, **Premium SSD**, or **Zone-redundant** storage.
42+
9. When you're done, select **Review + create** to create the snapshot.
43+
10. After the snapshot has been created, select **Home** > **Create a resource**.
44+
11. In the search box, enter **managed disk** and then select **Managed Disks** from the list.
45+
12. On the **Managed Disks** page, select **Create**.
46+
13. Choose a **Resource group** for the disk. You can use either an existing resource group or create a new one. This selection will also be used as the resource group where you create the VM from the disk.
47+
14. For **Region**, you must select the same region where the snapshot is located.
48+
15. Enter a **Name** for the disk.
49+
16. In **Source type**, ensure **Snapshot** is selected.
50+
17. In the **Source snapshot** drop-down, select the snapshot you want to use.
51+
18. For **Size**, you can change the storage type and size as needed.
52+
19. Make any other adjustments as needed and then select **Review + create** to create the disk. Once validation passes, select **Create**.
53+
54+
55+
After you have the disk that you want to use, you can create the VM in the portal:
56+
57+
1. In the search box, enter **disks** and then select **Disks** to display the list of available disks.
58+
3. Select the disk that you would like to use. The **Disk** page for that disk opens.
59+
4. In the **Essentials** section, ensure that **Disk state** is listed as **Unattached**. If it isn't, you might need to either detach the disk from the VM or delete the VM to free up the disk.
60+
4. In the menu at the top of the page, select **Create VM**.
61+
5. On the **Basics** page for the new VM, enter a **Virtual machine name** and either select an existing **Resource group** or create a new one.
62+
6. For **Size**, select **Change size** to access the **Size** page.
63+
7. The disk name should be pre-filled in the **Image** section.
64+
8. On the **Disks** page, you may notice that the **OS Disk Type** cannot be changed. This preselected value is configured at the point of Snapshot or VHD creation and will carry over to the new VM. If you need to modify disk type take a new snapshot from an existing VM or disk.
65+
9. On the **Networking** page, you can either let the portal create all new resources or you can select an existing **Virtual network** and **Network security group**. The portal always creates a new network interface and public IP address for the new VM.
66+
10. On the **Management** page, make any changes to the monitoring options.
67+
11. On the **Guest config** page, add any extensions as needed.
68+
12. When you're done, select **Review + create**.
69+
13. If the VM configuration passes validation, select **Create** to start the deployment.
70+
71+
72+
73+
74+
### [PowerShell](#tab/powershell)
75+
3276

3377
If you had a VM that you deleted and you want to reuse the OS disk to create a new VM, use [Get-AzDisk](/powershell/module/az.compute/get-azdisk).
3478

@@ -41,14 +85,6 @@ $osDisk = Get-AzDisk `
4185
```
4286
You can now attach this disk as the OS disk to a [new VM](#create-the-new-vm).
4387

44-
45-
46-
## Create the new VM
47-
48-
Create networking and other VM resources to be used by the new VM.
49-
50-
### Create the subnet and virtual network
51-
5288
Create the [virtual network](../../virtual-network/virtual-networks-overview.md) and subnet for the VM.
5389

5490
1. Create the subnet. This example creates a subnet named *mySubNet*, in the resource group *myDestinationResourceGroup*, and sets the subnet address prefix to *10.0.0.0/24*.
@@ -72,8 +108,7 @@ Create the [virtual network](../../virtual-network/virtual-networks-overview.md)
72108
```
73109
74110
75-
### Create the network security group and an RDP rule
76-
To be able to sign in to your VM with remote desktop protocol (RDP), you'll need to have a security rule that allows RDP access on port 3389. In our example, the VHD for the new VM was created from an existing specialized VM, so you can use an account that existed on the source virtual machine for RDP. This example denies RDP traffic, to be more secure. You can change `-Access` to `Allow` if you want to allow RDP access.
111+
To be able to sign in to your VM with remote desktop protocol (RDP), you'll need to have a security rule that allows RDP access on port 3389. In our example, the VHD for the new VM was created from an existing Windows specialized VM, so you can use an account that existed on the source virtual machine for RDP. This example denies RDP traffic, to be more secure. You can change `-Access` to `Allow` if you want to allow RDP access.
77112
78113
This example sets the network security group (NSG) name to *myNsg* and the RDP rule name to *myRdpRule*.
79114
@@ -93,7 +128,6 @@ $nsg = New-AzNetworkSecurityGroup `
93128

94129
For more information about endpoints and NSG rules, see [Opening ports to a VM in Azure by using PowerShell](nsg-quickstart-powershell.md).
95130

96-
### Create a public IP address and NIC
97131
To enable communication with the virtual machine in the virtual network, you'll need a [public IP address](../../virtual-network/ip-services/public-ip-addresses.md) and a network interface.
98132

99133
1. Create the public IP. In this example, the public IP address name is set to *myIP*.
@@ -119,33 +153,27 @@ To enable communication with the virtual machine in the virtual network, you'll
119153
120154
121155
122-
### Set the VM name and size
123-
124-
This example sets the VM name to *myVM* and the VM size to *Standard_A2*.
156+
Set the VM name and size. This example sets the VM name to *myVM* and the VM size to *Standard_A2*.
125157
126158
```powershell
127159
$vmName = "myVM"
128160
$vmConfig = New-AzVMConfig -VMName $vmName -VMSize "Standard_A2"
129161
```
130162

131-
### Add the NIC
163+
Add the NIC.
132164

133165
```powershell
134166
$vm = Add-AzVMNetworkInterface -VM $vmConfig -Id $nic.Id
135167
```
136168

137169

138-
### Add the OS disk
139-
140-
Add the OS disk to the configuration by using [Set-AzVMOSDisk](/powershell/module/az.compute/set-azvmosdisk). This example sets the size of the disk to *128 GB* and attaches the disk as a *Windows* OS disk.
170+
Add the OS disk. Add the OS disk to the configuration by using [Set-AzVMOSDisk](/powershell/module/az.compute/set-azvmosdisk). This example sets the size of the disk to *128 GB* and attaches the disk as a *Windows* OS disk.
141171

142172
```powershell
143173
$vm = Set-AzVMOSDisk -VM $vm -ManagedDiskId $osDisk.Id -StorageAccountType Standard_LRS `
144174
-DiskSizeInGB 128 -CreateOption Attach -Windows
145175
```
146176

147-
### Complete the VM
148-
149177
Create the VM by using [New-AzVM](/powershell/module/az.compute/new-azvm) with the configurations that we just created.
150178

151179
```powershell
@@ -161,13 +189,12 @@ RequestId IsSuccessStatusCode StatusCode ReasonPhrase
161189
162190
```
163191

164-
### Verify that the VM was created
165192
You should see the newly created VM either in the [Azure portal](https://portal.azure.com) under **Browse** > **Virtual machines**, or by using the following PowerShell commands.
166193

167194
```powershell
168195
$vmList = Get-AzVM -ResourceGroupName $destinationResourceGroup
169196
$vmList.Name
170197
```
171-
198+
---
172199
## Next steps
173200
Sign in to your new virtual machine. For more information, see [How to connect and log on to an Azure virtual machine running Windows](connect-logon.md).

articles/virtual-machines/windows/create-vm-specialized-portal.md renamed to articles/virtual-machines/create-vm-specialized-portal.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
2-
title: Create a Windows VM from a specialized VHD in the Azure portal
3-
description: Create a new Windows VM from a VHD in the Azure portal.
2+
title: Create a VM from a specialized VHD in the Azure portal
3+
description: Create a new VM by attaching a specialized disk in the Azure portal.
44
author: cynthn
55
ms.service: virtual-machines
6-
ms.subservice: imaging
7-
ms.collection: windows
6+
ms.subservice:
87
ms.workload: infrastructure-services
98
ms.topic: how-to
109
ms.date: 03/30/2023
@@ -25,9 +24,7 @@ ms.author: cynthn
2524
2625

2726

28-
If you already have a virtual hard disk (VHD) to use or you want to copy the VHD from an existing VM to use, you can create a new VM by *attaching* the VHD to the new VM as an OS disk.
29-
30-
You can also create a new VM from the VHD of a VM that has been deleted. For example, if you have an Azure VM that isn't working correctly, you can delete the VM and use its VHD to create a new VM.
27+
If you already have a virtual hard disk (VHD) to use, you can create a new VM by *attaching* the VHD to the new VM as an OS disk. This is useful when you want to create a new VM from the VHD of a VM that has been deleted. For example, if you have an Azure VM that isn't working correctly, you can delete the VM and use its VHD to create a new VM.
3128

3229
We recommend that you limit the number of concurrent deployments to 20 VMs from a single snapshot or VHD.
3330

@@ -66,7 +63,7 @@ After you have the disk that you want to use, you can create the VM in the porta
6663
5. On the **Basics** page for the new VM, enter a **Virtual machine name** and either select an existing **Resource group** or create a new one.
6764
6. For **Size**, select **Change size** to access the **Size** page.
6865
7. The disk name should be pre-filled in the **Image** section.
69-
8. On the **Disks** page, you may notice that the "OS Disk Type" cannot be changed. This preselected value is configured at the point of Snapshot or VHD creation and will carry over to the new VM. If you need to modify disk type take a new snapshot from an existing VM or disk.
66+
8. On the **Disks** page, you may notice that the **OS Disk Type** cannot be changed. This preselected value is configured at the point of Snapshot or VHD creation and will carry over to the new VM. If you need to modify disk type take a new snapshot from an existing VM or disk.
7067
9. On the **Networking** page, you can either let the portal create all new resources or you can select an existing **Virtual network** and **Network security group**. The portal always creates a new network interface and public IP address for the new VM.
7168
10. On the **Management** page, make any changes to the monitoring options.
7269
11. On the **Guest config** page, add any extensions as needed.

0 commit comments

Comments
 (0)