Your current NAV system might be running in a virtual environment in Azure using session-based hosting through Remote Desktop Services (RDS). Since July 1st, Microsoft officially changed Windows Azure licensing terms to allow the use of RDS on Windows Azure virtual machines, which is great news for many organizations. After evaluating the benefits of migrating your NAV VM to Windows Azure, your organization has decided to make the move.
Below, I outline the steps to automate the migration of a Dynamics NAV Virtual Machine (VM) to Windows Azure using PowerShell script.
It is important to note that Windows Azure supports the Windows OS platform starting from Windows Server 2008 R2. If your NAV is still running on Windows 2003 R2 or lower, it will not be supported by Windows Azure.
Dynamics NAV Azure Migration Steps
Step 1: Migration assessment
- VHD size – the VM has one VHD, about 80GB, not too large to upload, depending on your internet upload speed, it might take about 1-2 days to upload.
- Active Directory – the VM is a standalone server and not joining any domain, so there is no need to setup the virtual network
- Integration – If there are any integration points to other systems, it is necessary to investigate if the IP address or FQDN of the server changes will have any impact.
Ensure the Remote Desktop is enabled and the Windows Firewall is configured to allow remote desktop connections.
Step 2: Prepare VHD for migration
- Install the latest Windows updates
- Convert it to VHD format if it’s VHDX
- Convert it to fixed size format VHD if it’s dynamic
Step 3: Prepare Windows Azure account
Sign up for a Windows Azure trial HERE first for testing. You can always apply your subscription later on.
Follow the instructions HERE to create a storage account. This, too, can be automated by running the PowerShell script below if you’ve configured PowerShell for Windows Azure.
New-AzureStorageAccount -Location "West US" -StorageAccountName CompanyNameStorage01
Step 4: Configure PowerShell for Windows Azure
Download and install the Windows Azure PowerShell Module by following the instructions HERE
Run PowerShell ISE as administrator.
In PowerShell ISE, run the following commands to connect to your Windows Azure subscription account.
Set-ExecutionPolicy RemoteSigned -force
Import-Module Azure
Get-AzurePublishSettingsFile
# it will bring you to the Windows Azure subscription page in your browser, after you've signed in, the Azure subscription file will be generated and be downloaded.
Import-AzurePublishSettingsFile "D:AzureFree Trial-11-9-2013-credentials.publishsettings" # replace D:AzureFree Trial-11-9-2013-credentials.publishsettings with your actual subscription settings file
Step 5: Run PowerShell script to provision VM and upload the VHD
# your storage account
$StorageAccountName = "CompanyNameStorage01"
# your source VHD location
$vhdsource = 'D:AzureCompanyNameCompanyNameNAV.vhd'
# your upload location
$vhddestination= 'https://' + $StorageAccountName + '.blob.core.windows.net/vhds/CompanyNameNAV.vhd'
Add-AzureVhd -LocalFilePath $vhdsource -Destination $vhddestination # this will take a long time depending on your internet upload speed
Add-AzureDisk -OS Windows -MediaLocation $vhddestination -DiskName 'CompanyNameNAVDisk'
# Create VM
New-AzureVMConfig -Name CompanyNameNAV -DiskName 'CompanyNameNAVDisk' -InstanceSize 'Large' | New-AzureVM -ServiceName "CompanyNameNAV" -Location "West US"
# Add RDP endpoint (use the standard port 3389)
Get-AzureVM -servicename 'CompanyNameNAV' -name 'CompanyNameNAV' | Add-AzureEndpoint -Name 'RDP' -Protocol tcp -LocalPort 3389 -PublicPort 3389 | Update-AzureVM
Once it’s been successfully run, log into the Windows Azure Management Portal and download the RDP connection file to test the VM on Windows Azure.
Accessing NAV on Azure
Now, your users just need to point to the new URL/IP address to access to the VM, everything else stays the same.
What if my current NAV is not running on a Hyper-V VM?
If you want to give it a try, you can first convert the physical disk to a VHD by using the DiskToVHD tool from Windows Sysinternals. It works for converting the vmdk to vhd as well if your NAV is running on a VMWare infrastructure.
Considering the impact that a change like this can have on your organization, migrating NAV to Windows Azure is a relatively straightforward process. For a full recap of the benefits of moving NAV to Azure, refer to my previous post.
Please note that all the scripts above are generic and are intended for demonstration purposes only. The above must be adjusted to your own Azure environment before they will be effective.