Skip to content

Commit 3bfd1ab

Browse files
authored
Merge pull request #158076 from anvar-ms/MarchDocs
powershell changes
2 parents e78f0ad + 48174e1 commit 3bfd1ab

File tree

1 file changed

+62
-40
lines changed

1 file changed

+62
-40
lines changed

articles/migrate/tutorial-migrate-vmware-powershell.md

Lines changed: 62 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: rahulg1190
55
ms.author: rahugup
66
manager: bsiva
77
ms.topic: tutorial
8-
ms.date: 03/02/2021
8+
ms.date: 05/11/2021
99
---
1010

1111
# Migrate VMware VMs to Azure (agentless) - PowerShell
@@ -65,10 +65,12 @@ As part of prerequisites, you would have already created an Azure Migrate projec
6565
```azurepowershell-interactive
6666
# Get resource group of the Azure Migrate project
6767
$ResourceGroup = Get-AzResourceGroup -Name MyResourceGroup
68-
68+
```
69+
```azurepowershell-interactive
6970
# Get details of the Azure Migrate project
7071
$MigrateProject = Get-AzMigrateProject -Name MyMigrateProject -ResourceGroupName $ResourceGroup.ResourceGroupName
71-
72+
```
73+
```azurepowershell-interactive
7274
# View Azure Migrate project details
7375
Write-Output $MigrateProject
7476
```
@@ -134,22 +136,20 @@ After completing discovery and initializing replication infrastructure, you can
134136

135137
You can specify the replication properties as follows.
136138

137-
- **Target subscription and resource group** - Specify the subscription and resource group that the VM should be migrated to by providing the resource group ID using the (`TargetResourceGroupId`) parameter.
138-
- **Target virtual network and subnet** - Specify the ID of the Azure Virtual Network and the name of the subnet that the VM should be migrated to by using the (`TargetNetworkId`) and (`TargetSubnetName`) parameters respectively.
139-
- **Target VM name** - Specify the name of the Azure VM to be created by using the (`TargetVMName`) parameter.
140-
- **Target VM size** - Specify the Azure VM size to be used for the replicating VM by using (`TargetVMSize`) parameter. For instance, to migrate a VM to D2_v2 VM in Azure, specify the value for (`TargetVMSize`) as "Standard_D2_v2".
141-
- **License** - To use Azure Hybrid Benefit for your Windows Server machines that are covered with active Software Assurance or Windows Server subscriptions, specify the value for (`LicenseType`) parameter as **WindowsServer**. Otherwise, specify the value for (`LicenseType`) parameter as "NoLicenseType".
142-
- **OS Disk** - Specify the unique identifier of the disk that has the operating system bootloader and installer. The disk ID to be used is the unique identifier (UUID) property for the disk retrieved using the [Get-AzMigrateDiscoveredServer](/powershell/module/az.migrate/get-azmigratediscoveredserver) cmdlet.
143-
- **Disk Type** - Specify the value for the (`DiskType`) parameter as follows.
144-
- To use premium-managed disks, specify "Premium_LRS" as value for (`DiskType`) parameter.
145-
- To use standard SSD disks, specify "StandardSSD_LRS" as value for (`DiskType`) parameter.
146-
- To use standard HDD disks, specify "Standard_LRS" as value for (`DiskType`) parameter.
147-
- **Infrastructure redundancy** - Specify infrastructure redundancy option as follows.
148-
- Availability Zone to pin the migrated machine to a specific Availability Zone in the region. Use this option to distribute servers that form a multi-node application tier across Availability Zones. This option is only available if the target region selected for the migration supports Availability Zones. To use availability zones, specify the availability zone value for (`TargetAvailabilityZone`) parameter.
149-
- Availability Set to place the migrated machine in an Availability Set. The target Resource Group that was selected must have one or more availability sets to use this option. To use availability set, specify the availability set ID for (`TargetAvailabilitySet`) parameter.
150-
- **Boot Diagnostic Storage Account** - To use a boot diagnostic storage account, specify the ID for (`TargetBootDiagnosticStorageAccount`) parameter.
151-
- The storage account used for boot diagnostics should be in the same subscription that you're migrating your VMs to.
152-
- By default, no value is set for this parameter.
139+
**Parameter** | **Type** | **Description**
140+
--- | --- | ---
141+
Target subscription and resource group | Mandatory | Specify the subscription and resource group that the VM should be migrated to by providing the resource group ID using the (`TargetResourceGroupId`) parameter.
142+
Target virtual network and subnet | Mandatory | Specify the ID of the Azure Virtual Network and the name of the subnet that the VM should be migrated to by using the (`TargetNetworkId`) and (`TargetSubnetName`) parameters respectively.
143+
Machine ID | Mandatory | Specify the ID of the discovered machine that needs to be replicated and migrated. Use (`InputObject`) to specify the discovered VM object for replication.
144+
Target VM name | Mandatory | Specify the name of the Azure VM to be created by using the (`TargetVMName`) parameter.
145+
Target VM size | Mandatory | Specify the Azure VM size to be used for the replicating VM by using (`TargetVMSize`) parameter. For instance, to migrate a VM to D2_v2 VM in Azure, specify the value for (`TargetVMSize`) as "Standard_D2_v2".
146+
License | Mandatory | To use Azure Hybrid Benefit for your Windows Server machines that are covered with active Software Assurance or Windows Server subscriptions, specify the value for (`LicenseType`) parameter as **WindowsServer**. Otherwise, specify the value as **NoLicenseType**.
147+
OS Disk | Mandatory | Specify the unique identifier of the disk that has the operating system bootloader and installer. The disk ID to be used is the unique identifier (UUID) property for the disk retrieved using the [Get-AzMigrateDiscoveredServer](/powershell/module/az.migrate/get-azmigratediscoveredserver) cmdlet.
148+
Disk Type | Mandatory | Specify the name of the load balancer to be created.
149+
Infrastructure redundancy | Optional | Specify infrastructure redundancy option as follows. <br/><br/> - **Availability Zone** to pin the migrated machine to a specific Availability Zone in the region. Use this option to distribute servers that form a multi-node application tier across Availability Zones. This option is only available if the target region selected for the migration supports Availability Zones. To use availability zones, specify the availability zone value for (`TargetAvailabilityZone`) parameter. <br/> - **Availability Set** to place the migrated machine in an Availability Set. The target Resource Group that was selected must have one or more availability sets to use this option. To use availability set, specify the availability set ID for (`TargetAvailabilitySet`) parameter.
150+
Boot Diagnostic Storage Account | Optional | To use a boot diagnostic storage account, specify the ID for (`TargetBootDiagnosticStorageAccount`) parameter. <br/> - The storage account used for boot diagnostics should be in the same subscription that you're migrating your VMs to. <br/> - By default, no value is set for this parameter.
151+
152+
153153

154154
### Replicate VMs with all disks
155155

@@ -158,13 +158,17 @@ In this tutorial, we'll replicate all the disks of the discovered VM and specify
158158
```azurepowershell-interactive
159159
# Retrieve the resource group that you want to migrate to
160160
$TargetResourceGroup = Get-AzResourceGroup -Name MyTargetResourceGroup
161+
```
161162

163+
```azurepowershell-interactive
162164
# Retrieve the Azure virtual network and subnet that you want to migrate to
163165
$TargetVirtualNetwork = Get-AzVirtualNetwork -Name MyVirtualNetwork
164-
166+
```
167+
```azurepowershell-interactive
165168
# Start replication for a discovered VM in an Azure Migrate project
166169
$MigrateJob = New-AzMigrateServerReplication -InputObject $DiscoveredServer -TargetResourceGroupId $TargetResourceGroup.ResourceId -TargetNetworkId $TargetVirtualNetwork.Id -LicenseType NoLicenseType -OSDiskID $DiscoveredServer.Disk[0].Uuid -TargetSubnetName $TargetVirtualNetwork.Subnets[0].Name -DiskType Standard_LRS -TargetVMName MyMigratedTestVM -TargetVMSize Standard_DS2_v2
167-
170+
```
171+
```azurepowershell-interactive
168172
# Track job status to check for completion
169173
while (($MigrateJob.State -eq 'InProgress') -or ($MigrateJob.State -eq 'NotStarted')){
170174
#If the job hasn't completed, sleep for 10 seconds before checking the job status again
@@ -190,24 +194,34 @@ In the following example, we'll replicate only two disks of the discovered VM. W
190194
```azurepowershell-interactive
191195
# View disk details of the discovered server
192196
Write-Output $DiscoveredServer.Disk
197+
```
193198

199+
```azurepowershell-interactive
194200
# Create a new disk mapping for the disks to be replicated
195201
$DisksToReplicate = @()
196202
$OSDisk = New-AzMigrateDiskMapping -DiskID $DiscoveredServer.Disk[0].Uuid -DiskType StandardSSD_LRS -IsOSDisk true
197203
$DataDisk = New-AzMigrateDiskMapping -DiskID $DiscoveredServer.Disk[1].Uuid -DiskType Premium_LRS -IsOSDisk false
198204
199205
$DisksToReplicate += $OSDisk
200206
$DisksToReplicate += $DataDisk
207+
```
201208

209+
```azurepowershell-interactive
202210
# Retrieve the resource group that you want to migrate to
203211
$TargetResourceGroup = Get-AzResourceGroup -Name MyTargetResourceGroup
212+
```
204213

214+
```azurepowershell-interactive
205215
# Retrieve the Azure virtual network and subnet that you want to migrate to
206216
$TargetVirtualNetwork = Get-AzVirtualNetwork -Name MyVirtualNetwork
217+
```
207218

219+
```azurepowershell-interactive
208220
# Start replication for the VM
209221
$MigrateJob = New-AzMigrateServerReplication -InputObject $DiscoveredServer -TargetResourceGroupId $TargetResourceGroup.ResourceId -TargetNetworkId $TargetVirtualNetwork.Id -LicenseType NoLicenseType -DiskToInclude $DisksToReplicate -TargetSubnetName $TargetVirtualNetwork.Subnets[0].Name -TargetVMName MyMigratedTestVM -TargetVMSize Standard_DS2_v2
222+
```
210223

224+
```azurepowershell-interactive
211225
# Track job status to check for completion
212226
while (($MigrateJob.State -eq 'InProgress') -or ($MigrateJob.State -eq 'NotStarted')){
213227
#If the job hasn't completed, sleep for 10 seconds before checking the job status again
@@ -233,7 +247,8 @@ Track the status of the replication by using the [Get-AzMigrateServerReplication
233247
```azurepowershell-interactive
234248
# List replicating VMs and filter the result for selecting a replicating VM. This cmdlet will not return all properties of the replicating VM.
235249
$ReplicatingServer = Get-AzMigrateServerReplication -ProjectName $MigrateProject.Name -ResourceGroupName $ResourceGroup.ResourceGroupName -MachineName MyTestVM
236-
250+
```
251+
```azurepowershell-interactive
237252
# Retrieve all properties of a replicating VM
238253
$ReplicatingServer = Get-AzMigrateServerReplication -TargetObjectID $ReplicatingServer.Id
239254
```
@@ -315,26 +330,26 @@ $job = Get-AzMigrateJob -InputObject $job
315330

316331
The following properties can be updated for a VM.
317332

318-
- **VM Name** - Specify the name of the Azure VM to be created by using the [`TargetVMName`] parameter.
319-
- **VM size** - Specify the Azure VM size to be used for the replicating VM by using [`TargetVMSize`] parameter. For instance, to migrate a VM to D2_v2 VM in Azure, specify the value for [`TargetVMSize`] as `Standard_D2_v2`.
320-
- **Virtual Network** - Specify the ID of the Azure Virtual Network that the VM should be migrated to by using the [`TargetNetworkId`] parameter.
321-
- **Resource Group** - Specify the ID of the resource group that the VM should be migrated to by providing the resource group ID using the [`TargetResourceGroupId`] parameter.
322-
- **Network Interface** - NIC configuration can be specified using the [New-AzMigrateNicMapping](/powershell/module/az.migrate/new-azmigratenicmapping) cmdlet. The object is then passed an input to the [`NicToUpdate`] parameter in the [Set-AzMigrateServerReplication](/powershell/module/az.migrate/set-azmigrateserverreplication) cmdlet.
323333

324-
- **Change IP allocation** -To specify a static IP for a NIC, provide the IPv4 address to be used as static IP for the VM using the [`TargetNicIP`] parameter. To dynamically assign an IP for a NIC, provide `auto` as the value for the **TargetNicIP** parameter.
325-
- Use values `Primary`, `Secondary` or `DoNotCreate` for [`TargetNicSelectionType`] parameter to specify whether the NIC should be primary, secondary, or is not to be created on the migrated VM. Only one NIC can be specified as the primary NIC for the VM.
326-
- To make a NIC primary, you'll also need to specify the other NICs that should be made secondary or are not to be created on the migrated VM.
327-
- To change the subnet for the NIC, specify the name of the subnet by using the [`TargetNicSubnet`] parameter.
334+
**Parameter** | **Type** | **Description**
335+
--- | --- | ---
336+
VM Name | Optional | Specify the name of the Azure VM to be created by using the [`TargetVMName`] parameter.
337+
VM size | Optional | Specify the Azure VM size to be used for the replicating VM by using [`TargetVMSize`] parameter. For instance, to migrate a VM to D2_v2 VM in Azure, specify the value for [`TargetVMSize`] as `Standard_D2_v2`.
338+
Virtual Network | Optional | Specify the ID of the Azure Virtual Network that the VM should be migrated to by using the [`TargetNetworkId`] parameter.
339+
Resource Group | Optional | IC configuration can be specified using the [New-AzMigrateNicMapping](/powershell/module/az.migrate/new-azmigratenicmapping) cmdlet. The object is then passed an input to the [`NicToUpdate`] parameter in the [Set-AzMigrateServerReplication](/powershell/module/az.migrate/set-azmigrateserverreplication) cmdlet. <br/><br/> - **Change IP allocation** - To specify a static IP for a NIC, provide the IPv4 address to be used as static IP for the VM using the [`TargetNicIP`] parameter. To dynamically assign an IP for a NIC, provide `auto` as the value for the **TargetNicIP** parameter. <br/> - Use values `Primary`, `Secondary` or `DoNotCreate` for [`TargetNicSelectionType`] parameter to specify whether the NIC should be primary, secondary, or is not to be created on the migrated VM. Only one NIC can be specified as the primary NIC for the VM. <br/> - To make a NIC primary, you'll also need to specify the other NICs that should be made secondary or are not to be created on the migrated VM. <br/> - To change the subnet for the NIC, specify the name of the subnet by using the [`TargetNicSubnet`] parameter.
340+
Network Interface | Optional | Specify the name of the Azure VM to be created by using the [`TargetVMName`] parameter.
341+
Availability Zone | Optional | To use availability zones, specify the availability zone value for [`TargetAvailabilityZone`] parameter.
342+
Availability Set | Optional | To use availability set, specify the availability set ID for [`TargetAvailabilitySet`] parameter.
328343

329-
- **Availability Zone** - To use availability zones, specify the availability zone value for [`TargetAvailabilityZone`] parameter.
330-
- **Availability Set** - To use availability set, specify the availability set ID for [`TargetAvailabilitySet`] parameter.
331344

332345
The [Get-AzMigrateServerReplication](/powershell/module/az.migrate/get-azmigrateserverreplication) cmdlet returns a job which can be tracked for monitoring the status of the operation.
333346

334347
```azurepowershell-interactive
335348
# List replicating VMs and filter the result for selecting a replicating VM. This cmdlet will not return all properties of the replicating VM.
336349
$ReplicatingServer = Get-AzMigrateServerReplication -ProjectName $MigrateProject.Name -ResourceGroupName $ResourceGroup.ResourceGroupName -MachineName MyTestVM
350+
```
337351

352+
```azurepowershell-interactive
338353
# Retrieve all properties of a replicating VM
339354
$ReplicatingServer = Get-AzMigrateServerReplication -TargetObjectID $ReplicatingServer.Id
340355
@@ -352,10 +367,12 @@ $NicMapping2 = New-AzMigrateNicMapping -NicId $ReplicatingServer.ProviderSpecifi
352367
353368
$NicMapping += $NicMapping1
354369
$NicMapping += $NicMapping2
355-
370+
```
371+
```azurepowershell-interactive
356372
# Update the name, size and NIC configuration of a replicating server
357373
$UpdateJob = Set-AzMigrateServerReplication -InputObject $ReplicatingServer -TargetVMSize Standard_DS13_v2 -TargetVMName MyMigratedVM -NicToUpdate $NicMapping
358-
374+
```
375+
```azurepowershell-interactive
359376
# Track job status to check for completion
360377
while (($UpdateJob.State -eq 'InProgress') -or ($UpdateJob.State -eq 'NotStarted')){
361378
#If the job hasn't completed, sleep for 10 seconds before checking the job status again
@@ -381,10 +398,12 @@ Select the Azure Virtual Network to be used for testing by specifying the ID of
381398
```azurepowershell-interactive
382399
# Retrieve the Azure virtual network created for testing
383400
$TestVirtualNetwork = Get-AzVirtualNetwork -Name MyTestVirtualNetwork
384-
401+
```
402+
```azurepowershell-interactive
385403
# Start test migration for a replicating server
386404
$TestMigrationJob = Start-AzMigrateTestMigration -InputObject $ReplicatingServer -TestNetworkID $TestVirtualNetwork.Id
387-
405+
```
406+
```azurepowershell-interactive
388407
# Track job status to check for completion
389408
while (($TestMigrationJob.State -eq 'InProgress') -or ($TestMigrationJob.State -eq 'NotStarted')){
390409
#If the job hasn't completed, sleep for 10 seconds before checking the job status again
@@ -400,7 +419,8 @@ After testing is complete, clean-up the test migration using the [Start-AzMigrat
400419
```azurepowershell-interactive
401420
# Clean-up test migration for a replicating server
402421
$CleanupTestMigrationJob = Start-AzMigrateTestMigrationCleanup -InputObject $ReplicatingServer
403-
422+
```
423+
```azurepowershell-interactive
404424
# Track job status to check for completion
405425
while (($CleanupTestMigrationJob.State -eq "InProgress") -or ($CleanupTestMigrationJob.State -eq "NotStarted")){
406426
#If the job hasn't completed, sleep for 10 seconds before checking the job status again
@@ -420,7 +440,8 @@ If you don't want to turn-off the source server, then don't use [`TurnOffSourceS
420440
```azurepowershell-interactive
421441
# Start migration for a replicating server and turn off source server as part of migration
422442
$MigrateJob = Start-AzMigrateServerMigration -InputObject $ReplicatingServer -TurnOffSourceServer
423-
443+
```
444+
```azurepowershell-interactive
424445
# Track job status to check for completion
425446
while (($MigrateJob.State -eq 'InProgress') -or ($MigrateJob.State -eq 'NotStarted')){
426447
#If the job hasn't completed, sleep for 10 seconds before checking the job status again
@@ -438,7 +459,8 @@ Write-Output $MigrateJob.State
438459
```azurepowershell-interactive
439460
# Stop replication for a migrated server
440461
$StopReplicationJob = Remove-AzMigrateServerReplication -InputObject $ReplicatingServer
441-
462+
```
463+
```azurepowershell-interactive
442464
# Track job status to check for completion
443465
while (($StopReplicationJob.State -eq 'InProgress') -or ($StopReplicationJob.State -eq 'NotStarted')){
444466
#If the job hasn't completed, sleep for 10 seconds before checking the job status again

0 commit comments

Comments
 (0)