VMM allows SharePoint administrators to define a library of templates and VMs that can be used to provision new SharePoint sessions. For example, a Windows Server 2008 R2 server template could be created with the right amount of memory and virtual processors, plus a pair of virtual hard drives for the OS and index files. With SharePoint 2010 binaries installed on that system, it can then be turned into a template that can be used to provision new SharePoint farm members or even entirely new farms.
VMM Template Options, shown in Figure 12.6, allow administrators to have the server created from the template automatically added to a domain, be automatically validated with a valid server key, and also to have a script run after first login. For example, a custom PowerShell script could be run automatically after login that joins the SharePoint template server to an existing farm or creates a new farm from scratch.
Figure 12.6. Creating a VM template.
Using this concept, an organization could easily set up a scenario where developers are given the rights, through the self-service portal, to provision a new SharePoint guest session. After provisioning the server, they could then log in to that session and have it automatically run a PowerShell script that would create a new farm. With the proper hardware, developers could provision an entirely new SharePoint environment within 10 to 15 minutes and have that farm completely independent from other farms.
For this scenario to work, the SQL server used must be on a different system, because SQL doesn’t lend well to name changes after it has been installed. In this scenario, a single SQL instance can hold the databases from multiple farms. Commonly, a single SQL guest session would be used for all development farms created in this manner.
A sample farm provisioning script (ProvisionFarm.ps1) is provided here as an example of the type of script that can be configured to run automatically upon login to the virtual session provisioned:
The high-level steps involved in running this scenario are as follows:
Within approximately 15 minutes, a new SharePoint farm can be provisioned with running web applications and services. Using this approach, modifications can also be made to the PowerShell script to expand the functionality of the script, such as by adding the ability to provision service applications. In addition, it can be made to run completely without user input, providing for a 100-percent automated farm provisioning solution.
This same process can be used with other virtualization management software, such as the third-party VMware VirtualCenter. The concepts still apply: Just install the SharePoint 2010 binaries, and then create a server template. Using a provisioning script, you can then automatically create a new virtual farm or add additional members to it.