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
Copy file name to clipboardExpand all lines: azure-local/migrate/migrate-via-powershell.md
+20-22Lines changed: 20 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,10 @@
1
1
---
2
2
title: Migrate VMs to Azure Local with Azure Migrate using PowerShell
3
3
description: Learn how to migrate VMs to Azure Local with Azure Migrate using PowerShell.
4
-
author: trumanbrown
4
+
author: alkohli
5
5
ms.topic: how-to
6
-
ms.date: 05/21/2025
7
-
ms.author: trumanbrown
8
-
ms.reviewer: alkohli
9
-
ms.subservice: azurelocal
6
+
ms.date: 08/05/2025
7
+
ms.author: alkohli
10
8
---
11
9
12
10
# Migrate VMs to Azure Local with Azure Migrate using PowerShell
@@ -18,10 +16,10 @@ This article describes how to migrate VMs to Azure Local with Azure Migrate usin
18
16
Before you begin, you should complete the following tasks:
19
17
20
18
1. Complete the following prerequisites for the Azure Migrate project:
21
-
- For a Hyper-V source environment, complete the [Hyper-V prerequisites](https://learn.microsoft.com/azure/azure-local/migrate/migrate-hyperv-prerequisites) and [configure the source and target appliances](https://learn.microsoft.com/azure/azure-local/migrate/migrate-hyperv-replicate#step-1-create-and-configure-the-source-appliance).
22
-
- For a VMware source environment, complete the [VMware prerequisites](https://learn.microsoft.com/azure/azure-local/migrate/migrate-vmware-prerequisites) and [configure the source and target appliances](https://learn.microsoft.com/azure/azure-local/migrate/migrate-vmware-replicate#step-1-create-and-configure-the-source-vmware-appliance).
19
+
- For a Hyper-V source environment, complete the [Hyper-V prerequisites](migrate-hyperv-prerequisites.md) and [configure the source and target appliances](migrate-hyperv-replicate.md#step-1-create-and-configure-the-source-appliance).
20
+
- For a VMware source environment, complete the [VMware prerequisites](migrate-vmware-prerequisites.md) and [configure the source and target appliances](migrate-vmware-replicate.md#step-1-create-and-configure-the-source-vmware-appliance).
23
21
24
-
2. Install the [Azure PowerShell Az module](https://learn.microsoft.com/powershell/azure/install-azure-powershell).
22
+
2. Install the [Azure PowerShell Az module](/powershell/azure/install-azure-powershell).
25
23
26
24
<!-- Update version to 2.X.X in this paragraph-->
27
25
3. Verify the Azure Migrate PowerShell module is installed **and version is >=2.8.0**. Azure Migrate PowerShell is available as part of the Azure PowerShell Az module. Run the following command to check if Azure Migrate PowerShell is installed on your computer and verify the version is >=2.8.0:
@@ -49,12 +47,12 @@ Use the `Get-AzSubscription` cmdlet to get the list of Azure subscriptions you h
You can view the full list of Azure Migrate PowerShell cmdlets by visiting the [Azure Migrate PowerShell reference](https://learn.microsoft.com/powershell/module/az.migrate) or by running command `Get-Command -Module Az.Migrate`.
50
+
You can view the full list of Azure Migrate PowerShell cmdlets by visiting the [Azure Migrate PowerShell reference](/powershell/module/az.migrate) or by running command `Get-Command -Module Az.Migrate`.
53
51
54
52
## Retrieve discovered VMs
55
53
56
54
You can retrieve the discovered VMs in your Azure Migrate project using the `Get-AzMigrateDiscoveredServer` cmdlet. This cmdlet retrieves the list of VMs discovered by the source appliance in your Azure Migrate project. SourceMachineType can be either `HyperV` or `VMware`, depending on your source VM environment.
57
-
Learn more about the `Get-AzMigrateDiscoveredServer` cmdlet [here](https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratediscoveredserver).
55
+
Learn more about the `Get-AzMigrateDiscoveredServer` cmdlet [here](/powershell/module/az.migrate/get-azmigratediscoveredserver).
58
56
59
57
**Example 1**: Get all VMs discovered by an Azure Migrate source appliance in an Azure Migrate project:
You can initialize the replication infrastructure for your Azure Migrate project using the `Initialize-AzMigrateLocalReplicationInfrastructure` cmdlet. This cmdlet sets up the necessary infrastructure and metadata storage account needed to eventually replicate VMs from the source appliance to the target appliance. Running this cmdlet multiple times will not cause any issues, as it checks if the replication infrastructure is already initialized.
85
-
Learn more about the `Initialize-AzMigrateLocalReplicationInfrastructure` cmdlet [here](https://learn.microsoft.com/powershell/module/az.migrate/initialize-azmigratelocalreplicationinfrastructure).
83
+
Learn more about the `Initialize-AzMigrateLocalReplicationInfrastructure` cmdlet [here](/powershell/module/az.migrate/initialize-azmigratelocalreplicationinfrastructure).
86
84
87
85
You can use a default created storage account or a custom-created storage account that will store the replication metadata. You will need the source and target appliance names from the Azure Portal by navigating to your Azure Migrate project -> Appliances -> Registered appliances.
88
86
89
-

**Option 1**: Initialize replication infrastructure with the default storage account:
92
90
@@ -137,7 +135,7 @@ Get-AzStorageAccount `
137
135
## Replicate a VM
138
136
139
137
You can replicate a VM using the `New-AzMigrateLocalServerReplication` cmdlet. This cmdlet allows you to create a replication job for a discovered VM.
140
-
You can specify the target logical network, storage path, resource group, VM name, and target VM settings like OS disk, CPU, memory, and more. Learn more about the `New-AzMigrateLocalServerReplication` cmdlet [here](https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratelocalserverreplication).
138
+
You can specify the target logical network, storage path, resource group, VM name, and target VM settings like OS disk, CPU, memory, and more. Learn more about the `New-AzMigrateLocalServerReplication` cmdlet [here](/powershell/module/az.migrate/new-azmigratelocalserverreplication).
141
139
142
140
To further customize the replication job, you can define local disk and NIC mappings ahead of time using `New-AzMigrateLocalDiskMappingObject` and `New-AzMigrateLocalNicMappingObject` (see **Create a local disk mapping** and **Create a local NIC mapping object** below). These allow you to customize the disks and network interfaces are included during replication.
143
141
@@ -199,7 +197,7 @@ foreach ($DiscoveredServer in $DiscoveredServers)
199
197
200
198
Create a local disk mapping PS object using the `New-AzMigrateLocalDiskMappingObject` cmdlet. You can store multiple such objects in a list using `@()`.
201
199
You can customize the disk mapping object with parameters like `DiskID`, `IsOSDisk`, `IsDynamic`, `Format`, and `PhysicalSectorSize`.
202
-
Learn more about the `New-AzMigrateLocalDiskMappingObject` cmdlet [here](https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratelocaldiskmappingobject).
200
+
Learn more about the `New-AzMigrateLocalDiskMappingObject` cmdlet [here](/powershell/module/az.migrate/new-azmigratelocaldiskmappingobject).
203
201
204
202
>[!NOTE]
205
203
> If you are going to use the `-DiskToInclude` parameter in the `New-AzMigrateLocalServerReplication` cmdlet, you must create a local disk mapping object for **each** disk you want to include in the replication job.
@@ -236,7 +234,7 @@ $DiskMappings | Format-List *
236
234
### Create a local NIC mapping object
237
235
238
236
Create a local NIC mapping PS object using the `New-AzMigrateLocalNicMappingObject`. You can store multiple such objects in a list using `@()`.
239
-
Learn more about the `New-AzMigrateLocalNicMappingObject` cmdlet [here](https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratelocalnicmappingobject).
237
+
Learn more about the `New-AzMigrateLocalNicMappingObject` cmdlet [here](/powershell/module/az.migrate/new-azmigratelocalnicmappingobject).
240
238
241
239
**Example**
242
240
@@ -332,7 +330,7 @@ foreach ($DiscoveredServer in $DiscoveredServers)
332
330
333
331
### Retrieve replication jobs
334
332
335
-
Use the `Get-AzMigrateLocalJob` cmdlet to retrieve jobs about creating, updating, migrating, and removing replications. Learn more about the `Get-AzMigrateLocalJob` cmdlet [here](https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratelocaljob).
333
+
Use the `Get-AzMigrateLocalJob` cmdlet to retrieve jobs about creating, updating, migrating, and removing replications. Learn more about the `Get-AzMigrateLocalJob` cmdlet [here](/powershell/module/az.migrate/get-azmigratelocaljob).
Use the `Get-AzMigrateLocalServerReplication` cmdlet to retrieve (get) protected item. Learn more about the `Get-AzMigrateLocalServerReplication` cmdlet [here](https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratelocalserverreplication).
354
+
Use the `Get-AzMigrateLocalServerReplication` cmdlet to retrieve (get) protected item. Learn more about the `Get-AzMigrateLocalServerReplication` cmdlet [here](/powershell/module/az.migrate/get-azmigratelocalserverreplication).
Use the `Set-AzMigrateLocalServerReplication` cmdlet to update a replication protected item.
370
-
Learn more about the `Set-AzMigrateLocalServerReplication` cmdlet [here](https://learn.microsoft.com/powershell/module/az.migrate/set-azmigratelocalserverreplication).
368
+
Learn more about the `Set-AzMigrateLocalServerReplication` cmdlet [here](/powershell/module/az.migrate/set-azmigratelocalserverreplication).
### (Optional) Delete a replicating protected item
382
380
Use the `Remove-AzMigrateLocalServerReplication` cmdlet to delete a replicating protected item. This is useful if you want to stop a VM from replicating or if you want to start fresh with a new replication job if protected item became corrupted.
383
-
Learn more about the `Remove-AzMigrateLocalServerReplication` cmdlet [here](https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigratelocalserverreplication).
381
+
Learn more about the `Remove-AzMigrateLocalServerReplication` cmdlet [here](/powershell/module/az.migrate/remove-azmigratelocalserverreplication).
Use the `Start-AzMigrateLocalServerMigration` cmdlet to migrate a replication as part of planned failover.
395
393
You can use the `-TurnOffSourceServer` parameter to turn off the source VM after migration. This is useful for scenarios where you want to ensure that the source VM is no longer running after migration.
396
-
Learn more about the `Start-AzMigrateLocalServerMigration` cmdlet [here](https://learn.microsoft.com/powershell/module/az.migrate/start-azmigratelocalservermigration).
394
+
Learn more about the `Start-AzMigrateLocalServerMigration` cmdlet [here](/powershell/module/az.migrate/start-azmigratelocalservermigration).
397
395
398
396
> [!IMPORTANT]
399
397
> Before starting migration, verify replication succeeded by checking `$ProtectedItem.Property.AllowedJob` and ensuring it contains `PlannedFailover`.
Use the `Remove-AzMigrateLocalServerReplication` cmdlet to remove a protected item to complete migration.
420
418
Do not use this cmdlet until you have verified that the migration is successful and you no longer need the protected item in Azure Migrate.
421
-
Learn more about the `Remove-AzMigrateLocalServerReplication` cmdlet [here](https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigratelocalserverreplication).
419
+
Learn more about the `Remove-AzMigrateLocalServerReplication` cmdlet [here](/powershell/module/az.migrate/remove-azmigratelocalserverreplication).
0 commit comments