The method outlined below allows to create four distinct types of OCI VMs with varying configurations:
- Emulated Launch mode with BIOS (From a Hyper-V Gen1 VM)
- Paravirtualized Launch mode with BIOS (From a Hyper-V Gen1 VM)
- Emulated Launch mode with UEFI (From a Hyper-V Gen2 VM)
- Paravirtualized Launch mode with UEFI (From a Hyper-V Gen2 VM)
This approach provides flexibility in selecting different launch modes and firmware configurations, offering a comprehensive solution for diverse virtual machine setups.
- Hyper-V VMs in GEN1 (BIOS) (preferred) or GEN2 (UEFI)
- Boot Volume size: <400 GB
- Additional block volumes cannot be imported, the data must be imported separately.
- The VM must not be encrypted.
- Remove ISCSI controllers (if any).
- The boot process must not require additional data volumes to be present for a successful boot.
- The network configuration must not hardcode the MAC address for the network interface.
Run the following commands from PowerShell with Admin rights:
Get-NetAdapter | Where-Object { $_.Status -eq "Up" } | Set-NetIPInterface -Dhcp Enabled
Get-NetAdapter | Where-Object { $_.Status -eq "Up" } | Set-DnsClientServerAddress -ResetServerAddresses
Get-NetAdapter | Where-Object { $_.Status -eq "Up" } | ForEach-Object {Remove-NetRoute -InterfaceIndex $_.ifIndex -DestinationPrefix "0.0.0.0/0" -Confirm:$false}
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Value 0
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
Add-LocalGroupMember -Group "Remote Desktop Users" -Member "Administrator"
(Replace "Administrator" with the correct Admin name if needed)
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name "UserAuthentication" -Value 0
New-NetFirewallRule -DisplayName "Allow RDP from Any" -Direction Inbound -Protocol TCP -LocalPort 3389 -Action Allow -RemoteAddress Any -Profile Any
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled false
Get-CimInstance -ClassName SoftwareLicensingProduct | where {$_.PartialProductKey} | select ProductKeyChannel
If the license is not a volume license, after you import the image, you will update the license type.
pacman -S mingw-w64-x86_64-qemu
c:\msys64\mingw64\bin\qemu-img.exe convert -f vhdx -O qcow2 ..\SOURCE_DISK.vhdx ..\DESTINATION_DISK.qcow2
Storage > Object Storage & Archive Storage > Buckets > bucket_name > Upload
oci os object put -bn <destination_bucket_name> --file <path_to_the_VMDK_or_QCOW2_file>
Compute > Custom images > Import image
-
Create a custom image from the uploaded
.qcow2
located in the bucket:- Operating System: Windows
- Operating System Version: Server 2022 Standard (use the correct edition)
- Import from an Object Storage bucket
- Image Type: QCOW2
- Launch Mode: Emulated Mode
-
Edit the custom image capabilities after provisioning:
- Preferred firmware: Use BIOS (if GEN1), use UEFI (if GEN2).
- Preferred launch mode: EMULATED (Preferred) or PARAVIRTUALIZED (Provisioning may take longer, ~10-15 min).
- AMD SEV: Disabled
- Secure Boot: Disabled
- Preferred network attachment type: PARAVIRTUALIZED
- Preferred boot volume type: PARAVIRTUALIZED
- Preferred local data volume type: PARAVIRTUALIZED
- Preferred remote data volume type: PARAVIRTUALIZED
- Create the instance from the Custom Image:
- Specify the custom boot volume size:
- USE THE MINIMUM DISK SIZE INDICATED UNDER "BOOT VOLUME SIZE (GB)", e.g., 127 GB.
- DO NOT USE THE DEFAULT SIZE (50GB).
- Specify the custom boot volume size:
- Once you have successfully verified RDP connectivity to the VM:
- Backup the VM
- Enable the local firewall and configure Windows Defender or a third-party firewall:
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled true