訓練
認證
Microsoft Certified: Windows Server Hybrid Administrator Associate - Certifications
身為 Windows Server 混合式系統管理員,您會將 Windows Server 環境與 Azure 服務整合,並管理內部部署網路中的 Windows Server。
在本文中,您會了解如何使用適用於移轉和現代化的 Azure PowerShell,以利用無代理程式方法來移轉探索到的 VMware 虛擬機器 (VM)。
注意
此端對端 VMware 移轉案例檔目前為預覽狀態。 如需使用 Azure Migrate 的詳細資訊,請參閱 Azure Migrate 產品檔。
您將學習如何:
注意
教學課程顯示情節的最簡單部署路徑,讓您可以快速設定概念證明。 教學課程在情況允許時都會使用預設選項,且不會顯示所有可能的設定與路徑。
如果您沒有 Azure 訂用帳戶,請在開始前建立免費帳戶。
開始進行本教學課程之前,您必須:
Azure Migrate PowerShell 模組是 Azure PowerShell 的一部分 (Az
)。 執行 Get-InstalledModule -Name Az.Migrate
命令來檢查您的機器上是否已安裝 Azure Migrate PowerShell 模組。
使用 Connect-AzAccount Cmdlet,登入您的 Azure 訂用帳戶。
Connect-AzAccount
使用 Get-AzSubscription Cmdlet,取得您具有存取權的 Azure 訂用帳戶清單。 使用 Set-AzContext Cmdlet,選取具有您 Azure Migrate 專案的 Azure 訂用帳戶。
Set-AzContext -SubscriptionId aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e
Azure Migrate 專案可用來儲存從您評估或遷移的環境中收集到的探索、評量和移轉中繼資料。 在專案中,您可以追蹤探索到的資產、協調評量,以及執行移轉。
作為必要條件的一部分,您已建立 Azure Migrate 專案。 使用 Get-AzMigrateProject Cmdlet,擷取 Azure Migrate 專案的詳細資料。 您需要指定 Azure Migrate 專案的名稱 (Name
),以及 Azure Migrate 專案的資源群組名稱 (ResourceGroupName
)。
# Get resource group of the Azure Migrate project
$ResourceGroup = Get-AzResourceGroup -Name MyResourceGroup
# Get details of the Azure Migrate project
$MigrateProject = Get-AzMigrateProject -Name MyMigrateProject -ResourceGroupName $ResourceGroup.ResourceGroupName
# View Azure Migrate project details
Write-Output $MigrateProject
Azure Migrate and Modernize 會使用輕量型 Azure Migrate 設備。 作為必要條件的一部分,您已將 Azure Migrate 設備部署為 VMware VM。
若要在 Azure Migrate 專案中擷取特定的 VMware VM,請指定 Azure Migrate 專案的名稱 (ProjectName
)、Azure Migrate 專案的資源群組 (ResourceGroupName
) 和 VM 名稱 (DisplayName
)。
# Get a specific VMware VM in an Azure Migrate project
$DiscoveredServer = Get-AzMigrateDiscoveredServer -ProjectName $MigrateProject.Name -ResourceGroupName $ResourceGroup.ResourceGroupName -DisplayName MyTestVM | Format-Table DisplayName, Name, Type
# View discovered server details
Write-Output $DiscoveredServer
我們會在本教學課程期間移轉此 VM。
您也可以使用 ProjectName
和 ResourceGroupName
參數,擷取 Azure Migrate 專案中的所有 VMware VM。
# Get all VMware VMs in an Azure Migrate project
$DiscoveredServers = Get-AzMigrateDiscoveredServer -ProjectName $MigrateProject.Name -ResourceGroupName $ResourceGroup.ResourceGroupName
如果 Azure Migrate 專案中有多個設備,則您可以使用 ProjectName
、ResourceGroupName
和 ApplianceName
參數來擷取使用特定 Azure Migrate 設備探索到的所有 VM。
# Get all VMware VMs discovered by an Azure Migrate Appliance in an Azure Migrate project
$DiscoveredServers = Get-AzMigrateDiscoveredServer -ProjectName $MigrateProject.Name -ResourceGroupName $ResourceGroup.ResourceGroupName -ApplianceName MyMigrateAppliance
移轉和現代化會使用多個 Azure 資源來移轉 VM。 移轉和現代化會在與專案相同的資源群組中佈建下列資源。
複寫 Azure Migrate 專案中的第一個 VM 之前,請執行下列命令以佈建複寫基礎結構。 此命令會佈建和設定上述資源,讓您可以開始移轉 VMware VM。
注意
一個 Azure Migrate 專案僅支援遷移至一個 Azure 區域。 執行此指令碼之後,您無法變更 VMware VM 要移轉的目標區域。
如果您在 Azure Migrate 專案中設定新的設備,則需要執行 Initialize-AzMigrateReplicationInfrastructure
命令。
在本文中,我們會初始化複寫基礎結構,以將 VM 移轉至 Central US
區域。
# Initialize replication infrastructure for the current Migrate project
Initialize-AzMigrateReplicationInfrastructure -ResourceGroupName $ResourceGroup.ResourceGroupName -ProjectName $MigrateProject. Name -Scenario agentlessVMware -TargetRegion "CentralUS"
完成探索並初始化複寫基礎結構後,即可開始將 VMware VM 複寫至 Azure。 您最多可以同時執行 500 個複寫。
若要指定複寫屬性,請使用下表。
參數 | 類型 | 描述 |
---|---|---|
目標訂用帳戶和資源群組 | 必要 | 使用 TargetResourceGroupId 參數提供資源群組識別碼,以指定 VM 應移轉至的訂用帳戶和資源群組。 |
目標虛擬網路和子網路 | 必要 | 使用 TargetNetworkId 和 TargetSubnetName 參數,分別指定 VM 應移轉至的 Azure 虛擬網路執行個體的識別碼和子網路名稱。 |
機器識別碼 | 必要 | 指定需要複寫和移轉的探索到機器的識別碼。 使用 InputObject 來指定探索到的 VM 物件以進行複寫。 |
目標 VM 名稱 | 必要 | 使用 TargetVMName 參數,指定要建立的 Azure VM 名稱。 |
目標 VM 大小 | 必要 | 使用 TargetVMSize 參數,指定要用於複寫 VM 的 Azure VM 大小。 例如,若要將 VM 移轉至 Azure 中的 D2_v2 VM,請將 TargetVMSize 的值指定為 Standard_D2_v2 。 |
授權 | 必要 | 若要將 Azure Hybrid Benefit 用於有效的軟體保證或 Windows Server 訂用帳戶所涵蓋的 Windows Server 機器,請將 LicenseType 參數的值指定為 [WindowsServer]。 否則,請將值指定為 NoLicenseType。 |
作業系統磁碟 | 必要 | 指定具有作業系統開機載入器和安裝程式的磁碟的唯一識別碼。 要使用的磁碟識別碼是使用 Get-AzMigrateDiscoveredServer Cmdlet 所擷取磁碟的唯一識別碼 (UUID) 屬性。 |
磁碟類型 | 必要 | 指定要使用的磁碟類型。 |
基礎結構備援 | 選擇性 | 指定基礎結構備援選項,如下所示: - 可用性區域:將已移轉的機器釘選到區域中的特定可用性區域。 使用此選項可將形成多節點應用程式層的伺服器散發到可用性區域。 只有選取要移轉的目標區域支援可用性區域時,才能使用此選項。 若要使用可用性區域,請指定 TargetAvailabilityZone 參數的可用性區域值。 - 可用性設定組:將已移轉的機器放在可用性設定組中。 選取的目標資源群組必須有一或多個可用性設定組,才能使用此選項。 若要使用可用性設定組,請指定 TargetAvailabilitySet 參數的可用性設定組識別碼。 |
開機診斷儲存體帳戶 | 選擇性 | 若要使用開機診斷儲存體帳戶,請指定 TargetBootDiagnosticStorageAccount 參數的識別碼。 - 用於開機診斷的儲存體帳戶應該位於您要將 VM 移轉至其中的相同訂用帳戶內。 - 根據預設,不會設定此參數的值。 |
標籤 | 選擇性 | 將標記新增至已移轉的 VM、磁碟和 NIC。 使用 Tag 以將標記新增至 VM、磁碟和 NIC,或:- 使用 VMTag 以將標記新增至已移轉的 VM。- 使用 DiskTag 以將標記新增至磁碟。 - 使用 NicTag 以將標記新增至網路介面。 例如,將必要的標記新增至變數 $tags ,並在必要的參數中傳遞變數:$tags = @{Organization=”Contoso”} 。 |
在本教學課程中,我們會複寫探索到的 VM 的所有磁碟,並為 Azure 中的 VM 指定新的名稱。 我們會將探索到的伺服器的第一個磁碟指定為「OS 磁碟」,並以「標準 HDD」的形式移轉所有磁碟。 OS 磁碟是具有作業系統開機載入器和安裝程式的磁碟。 此 Cmdlet 會傳回工作,而此工作可以進行追蹤以監視作業狀態。
# Retrieve the resource group that you want to migrate to
$TargetResourceGroup = Get-AzResourceGroup -Name MyTargetResourceGroup
# Retrieve the Azure virtual network and subnet that you want to migrate to
$TargetVirtualNetwork = Get-AzVirtualNetwork -Name MyVirtualNetwork
# Start replication for a discovered VM in an Azure Migrate project
$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
# Track job status to check for completion
while (($MigrateJob.State -eq 'InProgress') -or ($MigrateJob.State -eq 'NotStarted')){
#If the job hasn't completed, sleep for 10 seconds before checking the job status again
sleep 10;
$MigrateJob = Get-AzMigrateJob -InputObject $MigrateJob
}
#Check if the Job completed successfully. The updated job state of a successfully completed job should be "Succeeded".
Write-Output $MigrateJob.State
您也可以使用 New-AzMigrateDiskMapping Cmdlet,並將其提供作為 New-AzMigrateServerReplication Cmdlet 中 DiskToInclude
參數的輸入,以選擇性地複寫探索到 VM 的磁碟。 您也可以使用 New-AzMigrateDiskMapping Cmdlet,為每個要複寫的個別磁碟指定不同的目標磁碟類型。
指定 New-AzMigrateDiskMapping Cmdlet 的下列參數值:
true
。 否則,請指定 false
。在下列範例中,我們只會複寫探索到 VM 的兩個磁碟。 我們會指定 OS 磁碟,並且為每個要複寫的磁碟使用不同的磁碟類型。 此 Cmdlet 會傳回工作,而此工作可以進行追蹤以監視作業狀態。
# View disk details of the discovered server
Write-Output $DiscoveredServer.Disk
# Create a new disk mapping for the disks to be replicated
$DisksToReplicate = @()
$OSDisk = New-AzMigrateDiskMapping -DiskID $DiscoveredServer.Disk[0].Uuid -DiskType StandardSSD_LRS -IsOSDisk true
$DataDisk = New-AzMigrateDiskMapping -DiskID $DiscoveredServer.Disk[1].Uuid -DiskType Premium_LRS -IsOSDisk false
$DisksToReplicate += $OSDisk
$DisksToReplicate += $DataDisk
# Retrieve the resource group that you want to migrate to
$TargetResourceGroup = Get-AzResourceGroup -Name MyTargetResourceGroup
# Retrieve the Azure virtual network and subnet that you want to migrate to
$TargetVirtualNetwork = Get-AzVirtualNetwork -Name MyVirtualNetwork
# Start replication for the VM
$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
# Track job status to check for completion
while (($MigrateJob.State -eq 'InProgress') -or ($MigrateJob.State -eq 'NotStarted')){
#If the job hasn't completed, sleep for 10 seconds before checking the job status again
sleep 10;
$MigrateJob = Get-AzMigrateJob -InputObject $MigrateJob
}
# Check if the Job completed successfully. The updated job state of a successfully completed job should be "Succeeded".
Write-Output $MigrateJob.State
在下列情況下,會進行複寫:
使用 Get-AzMigrateServerReplication Cmdlet 來追蹤複寫的狀態。
# List replicating VMs and filter the result for selecting a replicating VM. This cmdlet will not return all properties of the replicating VM.
$ReplicatingServer = Get-AzMigrateServerReplication -ProjectName $MigrateProject.Name -ResourceGroupName $ResourceGroup.ResourceGroupName -MachineName MyTestVM
# Retrieve all properties of a replicating VM
$ReplicatingServer = Get-AzMigrateServerReplication -TargetObjectID $ReplicatingServer.Id
您可以在輸出中追蹤 [移轉狀態] 和 [移轉狀態描述] 屬性。
InitialSeedingInProgress
和 Initial replication
。Replicating
和 Ready to migrate
。Migration succeeded
和 Migrated
。AllowedOperation : {DisableMigration, TestMigrate, Migrate}
CurrentJobId : /Subscriptions/xxx/resourceGroups/xxx/providers/Micr
osoft.RecoveryServices/vaults/xxx/replicationJobs/None
CurrentJobName : None
CurrentJobStartTime : 1/1/1753 1:01:01 AM
EventCorrelationId : 9d435c55-4660-41a5-a8ed-dd74213d85fa
Health : Normal
HealthError : {}
Id : /Subscriptions/xxx/resourceGroups/xxx/providers/Micr
osoft.RecoveryServices/vaults/xxx/replicationFabrics/xxx/replicationProtectionContainers/xxx/
replicationMigrationItems/10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_5009e941-3e40-
39b2-1e14-f90584522703
LastTestMigrationStatus :
LastTestMigrationTime :
Location :
MachineName : MyTestVM
MigrationState : InitialSeedingInProgress
MigrationStateDescription : Initial replication
Name : 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_5009e941-3e40-39b2-1e14-f90584522703
PolicyFriendlyName : xxx
PolicyId : /Subscriptions/xxx/resourceGroups/xxx/providers/Micr
osoft.RecoveryServices/vaults/xxx/replicationPolicies/xxx
ProviderSpecificDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.VMwareCbtMigrationDetails
TestMigrateState : None
TestMigrateStateDescription : None
Type : Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationMigrationItems
如需複寫進度的詳細資料,請執行下列 Cmdlet:
Write-Output $replicatingserver.ProviderSpecificDetail
您可以使用輸出中的 [初始植入進度百分比] 屬性來追蹤初始複寫進度。
"DataMoverRunAsAccountId": "/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.OffAzure/VMwareSites/xxx/runasaccounts/xxx",
"FirmwareType": "BIOS",
"InitialSeedingProgressPercentage": 20,
"InstanceType": "VMwareCbt",
"LastRecoveryPointReceived": "\/Date(1601733591427)\/",
"LicenseType": "NoLicenseType",
"MigrationProgressPercentage": null,
"MigrationRecoveryPointId": null,
"OSType": "Windows",
"PerformAutoResync": "true",
在下列情況下,會進行複寫:
您可以使用 Get-AzMigrateJob Cmdlet 來監視工作的狀態。
# Retrieve the updated status for a job
$job = Get-AzMigrateJob -InputObject $job
移轉和現代化可讓您變更複寫 VM 的目標屬性,例如名稱、大小、資源群組、NIC 設定等。
您可以更新 VM 的下列屬性。
參數 | 類型 | 描述 |
---|---|---|
VM 名稱 | 選擇性 | 使用 TargetVMName 參數,指定要建立的 Azure VM 名稱。 |
VM 大小 | 選擇性 | 使用 TargetVMSize 參數,指定要用於複寫 VM 的 Azure VM 大小。 例如,若要將 VM 移轉至 Azure 中的 D2_v2 VM,請將 TargetVMSize 的值指定為 Standard_D2_v2 。 |
虛擬網路 | 選擇性 | 使用 TargetNetworkId 參數,指定應將 VM 移轉至其中的 Azure 虛擬網路識別碼。 |
資源群組 | 選擇性 | 可以使用 New-AzMigrateNicMapping Cmdlet 來指定 NIC 設定。 接著,物件會傳入 Set-AzMigrateServerReplication Cmdlet 中作為 NicToUpdate 參數的輸入。 - 變更 IP 配置:若要指定 NIC 的靜態 IP,請使用 TargetNicIP 參數來提供要用作 VM 靜態 IP 的 IPv4 位址。 若要動態指派 NIC 的 IP,請提供 auto 作為 TargetNicIP 參數的值。 - 對於 TargetNicSelectionType 參數使用 Primary 、Secondary 或 DoNotCreate 值,以指定 NIC 應該為主要、次要,還是不應該在已移轉的 VM 上建立。 您只能將一個 NIC 指定為 VM 的主要 NIC。 - 若要將某個 NIC 設為主要,您也需要指定另一個應設為次要的 NIC,或不會在已移轉的 VM 上建立的 NIC。 - 若要變更 NIC 的子網路,請使用 TargetNicSubnet 參數來指定子網路的名稱。 |
網路介面 | 選擇性 | 使用 TargetVMName 參數,指定要建立的 Azure VM 名稱。 |
可用性區域 | 選擇性 | 若要使用可用性區域,請指定 TargetAvailabilityZone 參數的可用性區域值。 |
可用性設定組 | 選擇性 | 若要使用可用性設定組,請指定 TargetAvailabilitySet 參數的可用性設定組識別碼。 |
標籤 | 選擇性 | 對於更新標記,使用下列參數:UpdateTag 或 UpdateVMTag 、UpdateDiskTag 、UpdateNicTag 以及更新標記作業類型 UpdateTagOperation 或 UpdateVMTagOperation 、UpdateDiskTagOperation 、UpdateNicTagOperation 。 更新標記作業會採用下列值:Merge、Delete 和 Replace。 使用 UpdateTag 來更新 VM、磁碟與 NIC 之間的所有標記。 使用 UpdateVMTag 來更新 VM 標記。 使用 UpdateDiskTag 來更新磁碟標記。 使用 UpdateNicTag 來更新 NIC 標記。 使用 UpdateTagOperation 來更新 VM、磁碟與 NIC 之間所有標記的作業。 使用 UpdateVMTagOperation 來更新 VM 標記。 使用 UpdateDiskTagOperation 來更新磁碟標記。 使用 UpdateNicTagOperation 來更新 NIC 標記。 replace 選項會將整個現有標記集取代為新的集合。 merge 選項允許新增具有新名稱的標記,以及更新具有現有名稱的標記值。 delete 選項允許根據特定名稱或名稱/值組來選擇性地刪除標記。 |
Disks | 選擇性 | 若是 OS 磁碟: - 使用 TargetDiskName 參數來更新 OS 磁碟的名稱。 若要更新多個磁碟: - 使用 Set-AzMigrateDiskMapping,以將磁碟名稱設定為變數 $DiskMapping 。 然後使用 DiskToUpdate 參數,並與變數一起傳遞。 Set-AzMigrateDiskMapping 中要使用的磁碟識別碼是使用 Get-AzMigrateDiscoveredServer Cmdlet 所擷取磁碟的 UUID 屬性。 |
NIC 的名稱 | 選擇性 | 使用 New-AzMigrateNicMapping,以將 NIC 名稱設定為變數 $NICMapping 。 然後使用 NICToUpdate 參數,並傳遞變數。 |
Get-AzMigrateServerReplication Cmdlet 會傳回工作,而此工作可以進行追蹤以監視作業狀態。
# List replicating VMs and filter the result for selecting a replicating VM. This cmdlet will not return all properties of the replicating VM.
$ReplicatingServer = Get-AzMigrateServerReplication -ProjectName $MigrateProject.Name -ResourceGroupName $ResourceGroup.ResourceGroupName -MachineName MyTestVM
# Retrieve all properties of a replicating VM
$ReplicatingServer = Get-AzMigrateServerReplication -TargetObjectID $ReplicatingServer.Id
# View NIC details of the replicating server
Write-Output $ReplicatingServer.ProviderSpecificDetail.VMNic
在下列範例中,我們會將第一個 NIC 設為主要,並為其指派靜態 IP,以更新 NIC 設定。 我們會捨棄第二個 NIC 而不進行移轉,並更新目標 VM 名稱和大小,以及自訂 NIC 名稱。
# Specify the NIC properties to be updated for a replicating VM.
$NicMapping = @()
$NicMapping1 = New-AzMigrateNicMapping -NicId $ReplicatingServer.ProviderSpecificDetail.VMNic[0].NicId -TargetNicIP ###.###.###.### -TargetNicSelectionType Primary TargetNicName "ContosoNic_1"
$NicMapping2 = New-AzMigrateNicMapping -NicId $ReplicatingServer.ProviderSpecificDetail.VMNic[1].NicId -TargetNicSelectionType DoNotCreate - TargetNicName "ContosoNic_2"
$NicMapping += $NicMapping1
$NicMapping += $NicMapping2
# Update the name, size and NIC configuration of a replicating server
$UpdateJob = Set-AzMigrateServerReplication -InputObject $ReplicatingServer -TargetVMSize Standard_DS13_v2 -TargetVMName MyMigratedVM -NicToUpdate $NicMapping
在下列範例中,我們會自訂磁碟名稱。
# Customize the Disk names for a replicating VM
$OSDisk = Set-AzMigrateDiskMapping -DiskID "6000C294-1217-dec3-bc18-81f117220424" -DiskName "ContosoDisk_1"
$DataDisk1= Set-AzMigrateDiskMapping -DiskID "6000C292-79b9-bbdc-fb8a-f1fa8dbeff84" -DiskName "ContosoDisk_2"
$DiskMapping = $OSDisk, $DataDisk1
# Update the disk names for a replicating server
$UpdateJob = Set-AzMigrateServerReplication InputObject $ReplicatingServer DiskToUpdate $DiskMapping
在下列範例中,我們會將標記新增至複寫中 VM。
# Update all tags across virtual machines, disks, and NICs.
Set-azmigrateserverreplication UpdateTag $UpdateTag UpdateTagOperation Merge/Replace/Delete
# Update virtual machines tags
Set-azmigrateserverreplication UpdateVMTag $UpdateVMTag UpdateVMTagOperation Merge/Replace/Delete
使用下列範例來追蹤工作狀態。
# Track job status to check for completion
while (($UpdateJob.State -eq 'InProgress') -or ($UpdateJob.State -eq 'NotStarted')){
#If the job hasn't completed, sleep for 10 seconds before checking the job status again
sleep 10;
$UpdateJob = Get-AzMigrateJob -InputObject $UpdateJob
}
# Check if the Job completed successfully. The updated job state of a successfully completed job should be "Succeeded".
Write-Output $UpdateJob.State
在差異複寫開始後,即可在對 Azure 執行完整移轉之前,為 VM 執行測試移轉。 強烈建議您對每個機器都至少執行一次測試移轉,然後再遷移機器。 此 Cmdlet 會傳回工作,而此工作可以進行追蹤以監視作業狀態。
使用 TestNetworkID
參數指定虛擬網路的識別碼,以選取要用於測試的 Azure 虛擬網路。
# Retrieve the Azure virtual network created for testing
$TestVirtualNetwork = Get-AzVirtualNetwork -Name MyTestVirtualNetwork
# Start test migration for a replicating server
$TestMigrationJob = Start-AzMigrateTestMigration -InputObject $ReplicatingServer -TestNetworkID $TestVirtualNetwork.Id
# Track job status to check for completion
while (($TestMigrationJob.State -eq 'InProgress') -or ($TestMigrationJob.State -eq 'NotStarted')){
#If the job hasn't completed, sleep for 10 seconds before checking the job status again
sleep 10;
$TestMigrationJob = Get-AzMigrateJob -InputObject $TestMigrationJob
}
# Check if the Job completed successfully. The updated job state of a successfully completed job should be "Succeeded".
Write-Output $TestMigrationJob.State
測試完成之後,請使用 Start-AzMigrateTestMigrationCleanup Cmdlet 來清除測試移轉。 此 Cmdlet 會傳回工作,而此工作可以進行追蹤以監視作業狀態。
# Clean-up test migration for a replicating server
$CleanupTestMigrationJob = Start-AzMigrateTestMigrationCleanup -InputObject $ReplicatingServer
# Track job status to check for completion
while (($CleanupTestMigrationJob.State -eq "InProgress") -or ($CleanupTestMigrationJob.State -eq "NotStarted")){
#If the job hasn't completed, sleep for 10 seconds before checking the job status again
sleep 10;
$CleanupTestMigrationJob = Get-AzMigrateJob -InputObject $CleanupTestMigrationJob
}
# Check if the Job completed successfully. The updated job state of a successfully completed job should be "Succeeded".
Write-Output $CleanupTestMigrationJob.State
確認測試移轉如預期運作後,即可使用下列 Cmdlet 來移轉複寫伺服器。 此 Cmdlet 會傳回工作,而此工作可以進行追蹤以監視作業狀態。
如果您不想要關閉來源伺服器,則請不要使用 TurnOffSourceServer
參數。
# Start migration for a replicating server and turn off source server as part of migration
$MigrateJob = Start-AzMigrateServerMigration -InputObject $ReplicatingServer -TurnOffSourceServer
# Track job status to check for completion
while (($MigrateJob.State -eq 'InProgress') -or ($MigrateJob.State -eq 'NotStarted')){
#If the job hasn't completed, sleep for 10 seconds before checking the job status again
sleep 10;
$MigrateJob = Get-AzMigrateJob -InputObject $MigrateJob
}
#Check if the Job completed successfully. The updated job state of a successfully completed job should be "Succeeded".
Write-Output $MigrateJob.State
完成移轉之後,請使用下列 Cmdlet 來停止內部部署機器的複寫,並清除 VM 的複寫狀態資訊。 此 Cmdlet 會傳回工作,而此工作可以進行追蹤以監視作業狀態。
# Stop replication for a migrated server
$StopReplicationJob = Remove-AzMigrateServerReplication -InputObject $ReplicatingServer
# Track job status to check for completion
while (($StopReplicationJob.State -eq 'InProgress') -or ($StopReplicationJob.State -eq 'NotStarted')){
#If the job hasn't completed, sleep for 10 seconds before checking the job status again
sleep 10;
$StopReplicationJob = Get-AzMigrateJob -InputObject $StopReplicationJob
}
# Check if the Job completed successfully. The updated job state of a successfully completed job should be "Succeeded".
Write-Output $StopReplicationJob.State
執行任何移轉後應用程式調整,例如更新資料庫連接字串和 Web 伺服器設定。
在現在於 Azure 中執行的已移轉應用程式上,執行最終的應用程式和移轉接受度測試。
將流量完全移轉至已遷移的 Azure VM 執行個體。
從您的本機 VM 清查中移除內部部署 VM。
從本機備份中移除內部部署 VM。
更新任何內部文件,以顯示 Azure VM 的新位置和 IP 位址。
訓練
認證
Microsoft Certified: Windows Server Hybrid Administrator Associate - Certifications
身為 Windows Server 混合式系統管理員,您會將 Windows Server 環境與 Azure 服務整合,並管理內部部署網路中的 Windows Server。
文件
自動化 Azure Migrate 中的無代理程式 VMware 移轉 - Azure Migrate
描述如何在 Azure Migrate 中使用指令碼移轉大量 VMware VM
使用移轉和現代化工具來選取 VMware 移轉選項 - Azure Migrate
概述使用移轉和現代化工具以將 VMware VM 移轉至 Azure 的選項
使用移轉和現代化工具來移轉 VMware VM 無代理程式 - Azure Migrate
了解如何使用 Azure Migrate 執行 VMware VM 的無代理程式移轉。