Testing TFS in a Virtual Environment

I've been a long standing proponent of virtual environments, for creating isolated test environments or sandboxing test rigs they simply can't be beaten.  To that end I thought I would share some of the tricks I have used with the many virtual servers I have running under my desk at work that make creating TFS test rigs that little bit more bearable.

Active Directory
In order to have a dual tier or clustered setup for TFS a domain is required, rather than using your production domain setup a simple test domain.  I always create a DC with two network cards, one connected to a loopback adapter (see below) which allows access to a share on the host machine.  This is handy for moving files into the virtual domain.

Loopback
To make transferring files to the virtual domain that bit easier I would suggest you create a loopback network in Virtual Server.  To do this in 2003/XP open the control panel on the host machine and open the "Add New Hardware" wizard.  Select "Hardware is connected" then "Add new hardware device".  Choose "install the hardware I manually select", choose "Network Adapters" then "Microsoft" and "Loopback Adapter".  Open the properties for this new adapter and set the IP address to a static address in one of the private address spaces, I used 10.240.0.1 for example.  Open the Virtual Server master status page and add a new network.  Name it "Loop Back" or similar and choose the new loopback adapter from the drop down box then click ok.  Choose to configure the newly created virtual network then click on "DHCP Server" and enter the following or similar settings;

Network Address: 10.240.0.0
Network Mask: 255.255.0.0
Starting IP: 10.240.0.50
Ending IP: 10.240.0.99
Virtual DHCP Server Address: 10.240.0.1

Then click ok.  From now on, any time you create a new machine you can add it to the loopback network, it will automatically get an IP address and by using \\10.240.0.1 (or whatever static IP you assigned) your guest machines will be able to access the host machine.

Shared Setups
Assuming you have your DC running one trick I like to use it a shared setups disk attached to the DC.  I have a virtual network for the guest machines only and only the DC is connected to loopback, from here I have created a large virtual disk and added it as a second disk to the DC.  I then copied the setup files for TFS, SQL, et all, to this large virtual disk and shared it from the DC so that all the guests have access.

Those are my "Virtual Server Essentials" as it were and make virtual environments that bit easier to work with.  I hope these are of use to someone!

Thanks,
Jason