If managing multiple virtual
host machines, centralized management software is also highly
recommended. Microsoft has released its own product for VM management
and is positioning it as an enterprise utility that allows for
centralized control over a broader virtualization environment. This
tool, part of the System Center line of products, is known as System
Center Virtual Machine Manager (VMM). The latest version of VMM, the
2008 R2 edition, has the following tools and capabilities:
P2V and V2V— VMM allows for physical-to-virtual (P2V) or
virtual-to-virtual (V2V) migration capabilities, allowing existing
physical systems or VMware guests to be migrated to an equivalent
Hyper-V guest session.
Hyper-V and VMware management support— VMM provides for the ability to manage both
Microsoft Hyper-V and VMware guests, through management of a VMware
VirtualCenter server. Both VMware and Hyper-V guests and hosts can be
managed through the interface.
Creation of template servers— VMM supports the creation of server templates, which can be
used to automate the creation of virtual guests, including SharePoint
role servers.
Self-service portal— VMM contains a self-service web portal that can
be used by nonadministrators to provision their own systems and remote
into them using a web browser.
Exploring the VMM
Console
VMM 2008 R2’s management console, shown in Figure 1, provides a wide degree of functionality that can
be used to manage virtual SharePoint guests. This console allows a
distributed virtualized SharePoint farm to be more tightly managed, and
gives administrators a tool they can use to easily move guest sessions
between one or more hosts (and to perform other virtualization tasks).
Exploring the
Self-Service Portal
In addition to the
default Microsoft Management Console (MMC), VMM includes a web-based
self-service portal, shown in Figure 2, that enables administrators to delegate the rights to
create new guest sessions. This portal can be used by to allow
developers, for example, to provision their own test SharePoint server
sessions or allow quality assurance (QA) testers to provision guest
Windows and Office client sessions for testing.
The permissions allocated to
the self-service portal are unique, and users logged in to the portal
see only those systems that they created or have rights to manage. In
addition, administrators can create “quotas” that define how many guest
sessions an individual user may provision at a time.
Provisioning Farm
Members from Virtual Server Templates
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 3, 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.
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:
PROVISIONFARM.PS1
$configType = read-host "Do you wish to join an existing Farm? (Y/N)"
if ($ConfigType -eq "Y") {
$DatabaseServer = read-host "Sounds good. Please specify the name of your SQL Server";
$ConfigDB = read-host "Next, specify the name of your Farm Configuration Database";
$Passphrase = read-host "Finally, please enter your Farm passphrase" -assecurestring
} else {
$DatabaseServer = read-host "In that case, let's create a new Farm. Please specify the name of your SQL Server";
$FarmName = read-host "Please specify a name for your Farm (ex. SP2010Dev)";
$ConfigDB = $FarmName+"_ConfigDB";
$AdminContentDB = $FarmName+"_Admin_ContentDB";
Write-Host "Please enter the credentials for your Farm Account (ex. CONTOSO\SP_Farm)";
$FarmAcct = Get-Credential;
$Passphrase = read-host "Enter a secure Farm passphrase" -assecurestring;
$Port = read-host "Enter a port number for the Central Administration Web App";
$Authentication = read-host "Finally, specify your authentication provider (NTLM/Kerberos)";
}
if ($ConfigType -eq "Y") {
Add-PSSnapin Microsoft.SharePoint.PowerShell;
Connect-SPConfigurationDatabase -DatabaseName $ConfigDB -DatabaseServer
$DatabaseServer -Passphrase $Passphrase
} else {
Add-PSSnapin Microsoft.SharePoint.PowerShell;
Write-Host "Your SharePoint Farm is being configured..."
New-SPConfigurationDatabase -DatabaseName $ConfigDB -DatabaseServer $DatabaseServer -AdministrationContentDatabaseName $AdminContentDB -Passphrase $Passphrase -FarmCredentials $FarmAcct
}
Initialize-SPResourceSecurity
Install-SPService
Install-SPFeature -AllExistingFeatures
New-SPCentralAdministration -Port $Port -WindowsAuthProvider $Authentication
Install-SPHelpCollection -All
Install-SPApplicationContent
Write-Host "Your SharePoint 2010 Farm has been created!"
if ($ConfigType -eq "N") {
$WebAppCreation = read-host "Would you like to provision a Web Application using the default Team Site Template? (Y/N)";
if ($WebAppCreation -eq "Y") {
$HostHeaderQ = read-host "Would you like to specify a host header? (Y/N)";
if ($HostHeaderQ -eq "Y") {
$HostHeader = read-host "Please specify a host header for your Web Application (ex. intranet.companyabc.com)";
$URL = "http://"+$HostHeader;
Write-Host "Creating your Web Application...";
New-SPWebApplication -Name "SharePoint 2010 Team Site" -Port 80 -HostHeader $FQDN -Url $URL -ApplicationPool "Content_AppPool" -ApplicationPoolAccount (Get-SPManagedAccount $FarmAcct.UserName) -DatabaseServer
$DatabaseServer -DatabaseName $FarmName + "_TeamSite_ContentDB_01";
New-SPSite $URL -OwnerAlias $FarmAcct.UserName -Language 1033 -Template "STS#0" -Name "Team Site";
Write-Host "Configuration completed.";
}
else {
Write-Host "Creating a Web Application using the default Team Site Template..."
}
}
else {
Write-Host "Configuration completed.";
}
}
Write-Host "Press any key to continue..."
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
The high-level steps
involved in running this scenario are as follows:
1. | Create a
new Windows Server 2008 R2 guest session in VMM with at least 10GB of
RAM and four virtual CPUs allocated to it. (Remember that SharePoint
2010 has large resource requirements.) Give the session two virtual hard
drives: one for the OS and another for the index.
|
2. | Install the SharePoint 2010 binaries on the guest
session but don’t run the Config Wizard. Copy the Provisioning Farm
PowerShell script into a directory on the server, such as C:\Scripts.
See step 3 for the syntax of the script name.
|
3. | Using VMM, turn the guest session into a server
template. Specify within the server template to automatically add the
machine into a domain and to run powershell.exe –noexit
C:\scripts\ProvisionFarm.ps1, as shown in Figure 3.
|
4. | Use the self-service portal to provision a new server
based off of the template. After the session has been created and added
to the domain, log in to the system and walk through the farm
provisioning script. Because the SharePoint 2010 binaries will already
be installed, the script will be able to provision a new farm or to add
the server into an existing farm.
|
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.