August 20, 2019•616 words
I was tasked recently with migrating an entire datacenter off of VMware and on to Azure, and their production servers were predominantly Server 2003. Yes, seriously.
There is no documented process for migrating Server 2003 to Azure because Microsoft doesn't support running Server 2003 in Azure. But, I was able to find some small tips here and there, and after many months (!) of testing I was able to come up with a relatively foolproof process for getting Server 2003 VMs out to Azure. These are rough notes, so you'll need to fill in some gaps with your own Azure knowledge.
The first thing to know is the Azure VM agent doesn't run on Server 2003, so you're not going to get any of the helpful reset networking, RDP config type stuff you get with 2008R2+ machines. What that also means is, since Azure lacks a console, you need to make absolutely certain your machine is reachable over the network when it boots in Azure.
Import necessary PowerShell modules:
Import-Module AzureRM Import-Module 'C:\Program Files\Microsoft Virtual Machine Converter\MvmcCmdlet.psd1'
Login to Azure account:
Login to 2003 VM and add local admin - this is critical because the domain will be uncontactable when booted in Hyper-V
Note: cached domain credentials can work, but only if you logged in recently
Download VMDK from VMware datastore - ensure you have enough space locally, as it will "expand" if it's thin provisioned
Also note the
-VhdType FixedHardDisk and
-VhdFormat vhd as Azure only supports Fixed VHDs, not dynamic or VHDX.
ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath .\Desktop\testserver.vmdk -DestinationLiteralPath 'C:\Users\Administrator\Desktop' -VhdType FixedHardDisk -VhdFormat vhd
Create new Hyper-V VM using converted VHD
- Launch Hyper-V
- New > Virtual Machine
- Set Name
- Generation 1
- Set RAM, Networking
- Use existing virtual disk - choose VHD (NOT VMDK)
- Finish and launch VM
Login to Hyper-V VM
- Install Hyper-V integration tools - gives mouse access
- Uninstall VMware tools
- Run Windows Updates
- Shutdown - make sure no blue-screen/clean shutdown because the "Add-AzureRmVhd" command you're about to run will check the filesystem for corruption
Set a resource group and destination for the uploaded VHD:
$rgname = "Test-RG" $destination = "https://your.blob.core.windows.net/vhds/testserver.vhd"
Add-AzureRmVhd -ResourceGroupName $rgname -Destination $destination -LocalFilePath .\Desktop\testserver.vhd
Create global VM variables:
$location = "Central US" $vmName = "myVM" $osDiskName = 'myOsDisk' $vnet = Get-AzureRmVirtualNetwork -Name "test-vnet" -ResourceGroupName $rgname
Create managed disk:
$osDisk = New-AzureRmDisk -DiskName $osDiskName -Disk (New-AzureRmDiskConfig -AccountType StandardLRS -Location $location -CreateOption Import -SourceUri $destination) -ResourceGroupName $rgname
Create security group and rule to allow all local traffic:
$nsgName = "myNsg" $allowAllRule = New-AzureRmNetworkSecurityRuleConfig -Name "LocalNetwork-AllowAll" -Description "Allows all traffic from local subnets" -Access Allow -Protocol * -Direction Inbound -Priority 100 -SourceAddressPrefix "192.168.0.0/17" -SourcePortRange * -DestinationAddressPrefix * -DestinationPortRange * $nsg = New-AzureRmNetworkSecurityGroup -ResourceGroupName $rgname -Location $location -Name $nsgName -SecurityRules $allowAllRule
Create a network interface:
Make sure your subnet Id is actually
$nicName = "myNicName" $nic = New-AzureRmNetworkInterface -Name $nicName -ResourceGroupName $rgname -Location $location -SubnetId $vnet.Subnets.Id -NetworkSecurityGroupId $nsg.Id
Create VM config:
$vmConfig = New-AzureRmVMConfig -VMName $vmName -VMSize "Standard_A2" $vm = Add-AzureRmVMNetworkInterface -VM $vmConfig -Id $nic.Id $vm = Set-AzureRmVMOSDisk -VM $vm -ManagedDiskId $osDisk.Id -StorageAccountType StandardLRS -CreateOption Attach -Windows
Deploy VM config:
New-AzureRmVM -ResourceGroupName $rgname -Location $location -VM $vm
If your VM isn't reachable over the network in 5-10 minutes, you can check Boot Diagnostics in Azure to take a look at where the login process is - Windows logo screen, updating, etc.
Not an easy process by any stretch, but this process brings together several hours of searching and notes, so should point you in the right direction.