Maintaining multiple AX environments can become time consuming when trying to keep settings, data and code base in sync. A master VM of an environment can be maintained with the latest config, code and data. The master VM can then cloned to refresh dev, qa and uat environments when needed.
Running AX on a VM is also a good way of isolating environments. Since it is difficult run multiple kernel versions of AX on the same machine, VM's allow a way around this. Cloning a Dynamics AX VM can be useful for if there is an additional developer that needs to use it or if QA would want to do testing on the same machine. Cloning a VM can be completed in less than an hour when using SSD drives.
Part of the problems with cloning a Dynamics AX VM is that AX will save the machine name into the registry values. When cloning a VM we will need to give the new machine a new name so it can join the same domain. We easily can get around this by using the hosts file on the new machine to redirect any traffic bound for the old machine name back to localhost.
Right click on the machine that you want to clone and click "Export..." This can be done while the machine is still running and will export a vhd of the machine in its current state. Choose the folder to expert to and click export.
Right click the host computer in the left hand pane and click import virtual machine. Choose the location of the vhd that was exported in the last step.
Choose to copy the virtual machine, creating a new ID.
Important.. Before starting the new VM make sure to disable the network adaptor for it. If the machine is started with the network adaptor connected then it will authenticate with the domain controller with the original computer name, this can cause the original VM to be unable to connect to the domain again. The message will be something like "The trust relationship between this workstation and the primary domain failed"
Once the cloned machine is started, in system properties change the computer name, then run the SysPrep utility.
Reboot, reconnect the network and rejoin the domain with the new computer name.
Open the host file from C:\Windows\System32\drivers\etc\hosts
Add two entries to this file, one with the original computer name (not the new computer name), and one with the original machines domain name.
Once this is done then the AOS should start fine, client will be able to connect without any configuration changes, retail async and realtime services will work with existing certificate.
If using TFS source control then you will need to reconfigure your workspace with the new machine name.