Migrate VM to Azure

最後更新: 2020-09-30

介紹

Microsoft 提供了兩個工具去搬 VM 到 Azure, 分別是

  • Azure Migrate:Server Assessment tool (沒用的, 可略過)
  • Azure Migrate:Server Migration tool

以下教學是用 agent-based migration

Step

  1. Setup an Azure IAM Permission
  2. 建立 Resource Group
  3. 建立 Pro. 及 Dev. Network
  4. 建立 Public IP
  5. Setup an Azure Migrate project
  6. Discovery Machines
  7. Prepare physical servers
  8. Setup Agent on VM
  9. Migration
  10. Delete an Azure Migrate project

 


VMs running Amazon Linux

 

VMs running Amazon Linux cannot be migrated as-is as Amazon Linux OS is only supported on AWS.

To migrate workloads running on Amazon Linux, you can spin up a CentOS/RHEL VM in Azure and

migrate the workload running on the AWS Linux machine using a relevant workload migration approach.

 


Set up an Azure IAM Permission

 

登入 https://portal.azure.com/

# 到以下板面後按右手邊的 "Add" 掣

'

# 加 Owner Role 比A/C

 


建立 Resource Group

 

# Resource Group 它是用來存放我們的 VM 及之後用來建立 Migration Project

# 注意選一個近自己的 Region (East Asia = HK)

 

# 建立 Pro. 及 Dev. Network

 

# 建立 network 用作 test v2v

# 建立 Public IP

 

 


Setup an Azure Migrate project

 

# 當建立了 migration project 後, RG 就會有 "microsoft.migrate/migrateprojects"

# 建立 Project

 


Discovery Machines

 

 

Generate the Azure Migrate project key

 

 


Prepare Process server

 

Process server的最小 Config:

8 GB RAM, 2 vCPUs, around 300 GB of disk storage

 * Set up an account that the appliance can use to access the physical servers. (administrator / root)

 * Check connect to Process server (9443/tcp) & configuration server (443/tcp)

 * Install the Mobility service

The appliance sends configuration and performance data for discovered VMs to

If all the writers are in a healthy/stable state, try restarting the following services from services.msc

 - Volume Shadow Copy

 - Azure Site Recovery VSS Provider

 

安裝 MicrosoftAzureSiteRecoveryUnifiedSetup

 

replication appliance installer: MicrosoftAzureSiteRecoveryUnifiedSetup.exe

Download: http://aka.ms/unifiedinstaller_ea

# Browse Discover Step Download 的 Key

 

# 之後可以在 Cspsconfigtool.ext 新增

 

# 在 Portal 按 "Finalize registration"

Shortcut

  • hostconfigwxcommon =  Host Agent Config
  • Cspsconfigtool= M$ Azure Site Recovery Configuation Server

Services

cxprocessserver
InMage Scout VX Agent – Sentinel/Outpost
Microsoft Azure Recovery Services Agent
Microsoft Azure Site Recovery Service
tmansvc

 


Setup Agent on VM (Mobility service)

 

# 在 Process server 查看 passphrase

C:\ProgramData\ASR\home\svsystems\bin\genpassphrase.exe -v

# 獲得 Mobility service 的 Installer

Microsoft-ASR_UA_9.37.0.0_Windows_GA_03Sep2020_Release.exe

%ProgramData%\ASR\home\svsystems\pushinstallsvc\repository

 

 


Setup Agent(Mobility service) on Linux VM

 

Install on Centos 7

mkdir /tmp/MobSvcInstaller

cd /tmp/MobSvcInstaller

wget http://.../Microsoft-ASR_UA_9.37.0.0_RHEL7-64_GA_03Sep2020_Release.tar.gz

tar -zxf Microsoft-ASR_UA_9.37.0.0_RHEL7-64_GA_03Sep2020_Release.tar.gz

./install -r MS -q

All product pre-requisties are met.
Generating the certificate.
New RPM package InMageVx-9.37.0.0-1 has been successfully installed.

Filter driver kernel module is not loaded. Attempting to load it, please wait...
Filter driver kernel module loaded successfully.
Filter device /dev/involflt created successfully.
Generating initrd images.
Generated initrd images successfully.
Installation process has finished.
Check the log file /var/log/ua_install.log for detailed diagnostic messages or
  installation success/failures...
Vx agent installation exit code : 0.
Check the log file /var/log/ua_install.log for detailed diagnostic messages or
  installation success/failures...
Installer exiting with code: 0

# Register the agent with the replication appliance:

touch /root/pw.txt

chmod 600 /root/pw.txt

vim /root/pw.txt

# /usr/local/ASR/Vx/bin/UnifiedAgentConfigurator.sh -i <replication appliance IP address> -P <Passphrase File Path>

/usr/local/ASR/Vx/bin/UnifiedAgentConfigurator.sh -i 192.168.88.247 -P /root/pw.txt

Value of cstype is CSLegacy
Platform value in drscout.conf: VmWare
Stopping Vx agent service...
Updating bios id in RCMInfo.conf
Value of cstype in csgetfingerprint is CSLegacy
Validating the passphrase.

Invoking an agent registration call...
Agent registration has completed successfully.
Starting UA Respawn daemon...
Agent configuration is completed successfully.
Check the log file /var/log/ua_install.log for detailed diagnostic messages or
  configuration success/failures...
Configurator exiting with code: 0

 


Migration

 

Windows License

Already have an eligible Windows Server License?

選 No => Azure Hybrid Benefit                # 如果已經有 M$ License

 

Checking

一段時間後, Jobs 會由 In progress 轉成 Successful

Replicate Status

"0% synchronized"

一段時間後...

"18% synchronized"

一段時間後...

Waiting for first recovery point

一段時間後...

“Protected”              # “Test migration” and “Migrate” are available

VM Info.

 

 


Test migration

 

 * After testing you need to clean up the test migration before performing the migration.

Replicating machines Status:

一段時間後...

Cleanup test failover pending        # VM Status: Running, 此時已經可以 test VM function

其間 Resource

 


Assign Public IP

 

 

 

 


Migrate

 

During the “Start failover” the VM will be provisioned with a temporary name and disappear.

The VM will reappear with the correct name during the last step “Start the replica virtual machine”.

 


Finish Migration

 

Now the VM is active in Azure a few final steps need to be performed:

    * Stop replication for the migrated server:
    * Install the Azure VM agent on the migrated machine.
    * Configure Backup (e.g. Azure Backup)

 


Delete an Azure Migrate project

 

In the Azure portal, open the resource group in which the project was created.

In the resource group page, select Show hidden types.
    
Select the project and the associated resources that you want to delete.
(The resource type for Azure Migrate projects is "Microsoft.Migrate/migrateprojects")

In the next section, review the resources created for discovery, assessment, and migration in an Azure Migrate project.

* Delete the key vault with caution because it might contain security keys.

"Appliancename"kv     Key vault
"Appliancename"site     microsoft.offazure/serversites
"Appliancename"project microsoft.migrate/assessmentprojects

 


Remark