Skip to content

Commit 1920294

Browse files
author
Cynthia Nottingham
committed
Fixes #49791
1 parent d8cd5c7 commit 1920294

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

articles/virtual-machines/windows/dedicated-hosts-portal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ This article guides you through how to create an Azure [dedicated host](dedicate
3434

3535
## Add an existing VM
3636

37-
You can add an exiting VM to a dedicated host, but the VM must first be Stop\Deallocated. Before you move a VM to a dedicated host, make sure that the VM configuration is supported:
37+
You can add an existing VM to a dedicated host, but the VM must first be Stop\Deallocated. Before you move a VM to a dedicated host, make sure that the VM configuration is supported:
3838

3939
- The VM size must be in the same size family as the dedicated host. For example, if your dedicated host is DSv3, then the VM size could be Standard_D4s_v3, but it could not be a Standard_A4_v2.
4040
- The VM needs to be located in same region as the dedicated host.

articles/virtual-machines/windows/dedicated-hosts-powershell.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,35 @@ Location : eastus
161161
Tags : {}
162162
```
163163

164+
## Add an existing VM
165+
166+
You can add an exiting VM to a dedicated host, but the VM must first be Stop\Deallocated. Before you move a VM to a dedicated host, make sure that the VM configuration is supported:
167+
168+
- The VM size must be in the same size family as the dedicated host. For example, if your dedicated host is DSv3, then the VM size could be Standard_D4s_v3, but it could not be a Standard_A4_v2.
169+
- The VM needs to be located in same region as the dedicated host.
170+
- The VM can't be part of a proximity placement group. Remove the VM from the proximity placement group before moving it to a dedicated host. For more information, see [Move a VM out of a proximity placement group](https://docs.microsoft.com/azure/virtual-machines/windows/proximity-placement-groups#move-an-existing-vm-out-of-a-proximity-placement-group)
171+
- The VM can't be in an availability set.
172+
- If the VM is in an availability zone, it must be the same availability zone as the host group. The availability zone settings for the VM and the host group must match.
173+
174+
```azurepowershell-interactive
175+
$vmRGName = "myResourceGroup"
176+
$vmName = "myVM"
177+
$dhRGName = "myDHResourceGroup"
178+
$dhGroupName = "myHostGroup"
179+
$dhName = "myHost"
180+
181+
$myDH = Get-AzHost -HostGroupName $dhGroupName -ResourceGroupName $dhRGName -Name $dhName
182+
183+
$myVM = Get-AzVM -ResourceGroupName $vmRGName -Name $vmName
184+
185+
$myVM.Host = New-Object Microsoft.Azure.Management.Compute.Models.SubResource
186+
187+
$myVM.Host.Id = "/subscriptions/$subId/resourceGroups/$dhRGName/providers/Microsoft.Compute/hostGroups/$dhgName/hosts/$dhName"
188+
189+
Update-AzVM -ResourceGroupName $vmRGName -VM $myVM -Debug
190+
```
191+
192+
164193
## Clean up
165194

166195
You are being charged for your dedicated hosts even when no virtual machines are deployed. You should delete any hosts you are currently not using to save costs.

0 commit comments

Comments
 (0)