Skip to content

Commit c7adfb0

Browse files
Merge pull request #244046 from vamckMS/adh-reassign-vm
ADH-reassign-VM
2 parents 14761b6 + 72c67e4 commit c7adfb0

File tree

1 file changed

+71
-1
lines changed

1 file changed

+71
-1
lines changed

articles/virtual-machines/dedicated-hosts-how-to.md

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ Move the VM to a dedicated host using the [portal](https://portal.azure.com).
357357
1. At the top of the page, select **Start** to restart the VM.
358358

359359

360-
## [CLI](#tab/cli)
360+
### [CLI](#tab/cli)
361361

362362
Move the existing VM to a dedicated host using the CLI. The VM must be Stop/Deallocated using [az vm deallocate](/cli/azure/vm#az_vm_stop) in order to assign it to a dedicated host.
363363

@@ -418,7 +418,77 @@ Start-AzVM `
418418

419419
---
420420

421+
## Move a VM from dedicated host to multi-tenant infrastructure
422+
You can move a VM that is running on a dedicated host to multi-tenant infrastructure, but the VM must first be Stop\Deallocated.
423+
424+
- Make sure that your subscription have sufficient vCPU quota for the VM in the region where
425+
- Your multi-tenant VM will be scheduled in the same region and zone as the dedicated host
426+
427+
428+
### [Portal](#tab/portal)
429+
430+
Move a VM from dedicated host to multi-tenant infrastructure using the [portal](https://portal.azure.com).
431+
432+
1. Open the page for the VM.
433+
1. Select **Stop** to stop\deallocate the VM.
434+
1. Select **Configuration** from the left menu.
435+
1. Select **XXXXX** under host group drop-down menu.
436+
1. When you're done, select **Save** at the top of the page.
437+
1. After the VM has been reconfigured as a multi-tenant VM, select **Overview** from the left menu.
438+
1. At the top of the page, select **Start** to restart the VM.
439+
440+
441+
### [CLI](#tab/cli)
442+
443+
Move a VM from dedicated host to multi-tenant infrastructure using the CLI. The VM must be Stop/Deallocated using [az vm deallocate](/cli/azure/vm#az_vm_stop) in order to assign it to reconfigure it as a multi-tenant VM.
444+
445+
Replace the values with your own information.
446+
447+
```azurecli-interactive
448+
az vm deallocate -n myVM -g myResourceGroup
449+
az vm update -n myVM -g myResourceGroup --set host.id=None
450+
az vm start -n myVM -g myResourceGroup
451+
```
452+
453+
454+
### [PowerShell](#tab/powershell)
455+
456+
Move a VM from dedicated host to multi-tenant infrastructure using the PowerShell.
457+
458+
Replace the values of the variables with your own information.
421459

460+
```azurepowershell-interactive
461+
$vmRGName = "moveoffhost"
462+
$vmName = "myDHVM"
463+
$dhRGName = "myDHResourceGroup"
464+
$dhGroupName = "myHostGroup"
465+
$dhName = "myHost"
466+
467+
$myDH = Get-AzHost `
468+
-HostGroupName $dhGroupName `
469+
-ResourceGroupName $dhRGName `
470+
-Name $dhName
471+
472+
$myVM = Get-AzVM `
473+
-ResourceGroupName $vmRGName `
474+
-Name $vmName
475+
476+
Stop-AzVM `
477+
-ResourceGroupName $vmRGName `
478+
-Name $vmName -Force
479+
480+
Update-AzVM `
481+
-ResourceGroupName $vmRGName `
482+
-VM $myVM `
483+
-HostId ''
484+
485+
Start-AzVM `
486+
-ResourceGroupName $vmRGName `
487+
-Name $vmName
488+
```
489+
490+
491+
---
422492
## Check the status of the host
423493

424494
If you need to know how much capacity is still available on a how, you can check the status.

0 commit comments

Comments
 (0)