Scripting provisioning & tear down of SharePoint farms in Windows Azure

Scripting provisioning & tear down of SharePoint farms in Windows Azure

Rate This
  • Comments 1

Windows azure provides a feature called Virtual Machines, basically it allows us to provision the infrastructure that is required to run your on premise applications in Windows Azure. For a list of server products that are supported to run on Azure Virtual Machines see http://support.microsoft.com/kb/2721672. SharePoint is one of the server products that is already supported. I’m sure you are probably thinking why would I want to do this, what benefits do I have, What are some of the key usage scenarios, etc. Windows Azure team has already published a really nice article that might answer all your questions http://www.windowsazure.com/en-us/manage/windows/other-resources/sharepoint-on-azure

In this post I will walk through the scripted solution I built for automating provisioning and teardown of SharePoint farms in Windows Azure. Before you can use Windows Azure PowerShell CmdLets, there is some prep work you have to do.  You should pretty much follow this article to configure your environment.

Provisioning Virtual Machines

High level steps

  • Create the Environment configuration file – Defines parameters for specific environment to provision
<Environment Name="VMLAB">
<!-- Azure Subscription Name -->
<SubscriptionName>Windows Azure MSDN - Visual Studio Ultimate</SubscriptionName>

<!-- Affinity Group -->
<AffinityGroup>
<Name>VMLAB-AG</Name>
<Location>West US</Location>
<Label>VMLAB-AG</Label>
<Description>Virtual Machine Lab Affinity Group</Description>
</AffinityGroup>

<!--Storage Account -->
<StorageAccount>
<!-- name must only contain lowercase characters and number -->
<Name>vmlabstorage</Name>
<Label>vmlabstorage</Label>
<MediaLocation>http://vmlabstorage.blob.core.windows.net/vhds/</MediaLocation>
</StorageAccount>

<!-- Additional Disks that will be added to all SharePoint Servers to be used for Storing Data and Logs -->
<Disks>
<Disk>
<Label>Logs</Label>
<DiskSizeInGb>35</DiskSizeInGb>
<LUN>0</LUN>
</Disk>
<Disk>
<Label>Data</Label>
<DiskSizeInGb>35</DiskSizeInGb>
<LUN>1</LUN>
</Disk>
</Disks>

<!-- Virtual Network -->
<VirtualNetwork>
<Name>VMLAB-VNET</Name>
<ConfigurationFile>C:\Users\ramgopin\SkyDrive\Documents\Scripts\Azure\NetworkConfig.xml</ConfigurationFile>
</VirtualNetwork>

<!-- Active Directory DEPLOYMENT -->
<CloudService>
<Name>VMLABDC-SERVICE</Name>
<Label>VMLABDC-SERVICE</Label>
<Description>VMLAB AD And DNS Service</Description>
<Domain>VMLAB.cloud</Domain>
<DomainAdmin>administrator</DomainAdmin>
<OU>OU=AzureVMs,DC=VMLAB,DC=cloud</OU>
<!-- DNS Settings -->
<Dns>
<Name>VMLabDNS</Name>
<IPAddress>10.0.4.4</IPAddress>
</Dns>

<Machines>
<!-- Domain Controller -->
<Machine Role="DC">
<Name>VMLAB-DC</Name>
<AvailabilitySet>DC-AVSET</AvailabilitySet>
<SubnetName>ADDNS-SUBNET</SubnetName>
<InstanceSize>Small</InstanceSize>
<VhdName>VMLAB-DC</VhdName>
<VMImageName>MSFT__Win2K8R2SP1-Datacenter-201210.01-en.us-30GB.vhd</VMImageName>
</Machine>
</Machines>
</CloudService>

<!-- ENVIRONMENT DEPLOYMENT -->
<CloudService>
<Name>VMLABSP-SERVICE</Name>
<Label>VMLABSP-SERVICE</Label>
<Description>VMLAB SharePoint 2010 Application Service</Description>
<DefaultVMImage>Win2k8R2DataCenter_SP2010SP1_OWA_LPKS_CU</DefaultVMImage>

<Machines>
<!-- Web Servers -->
<WebServers>
<AvailabilitySet>WEB-AVSET</AvailabilitySet>
<SubnetName>FE-SUBNET</SubnetName>

<WebServer>
<Name>SP-WFE1</Name>
<VhdName>SP-WFE1</VhdName>
<InstanceSize>Medium</InstanceSize>
<VMImageName></VMImageName>
</WebServer>
</WebServers>

<!-- Application Servers -->
<ApplicationServers>
<AvailabilitySet>APP-AVSET</AvailabilitySet>
<SubnetName>FE-SUBNET</SubnetName>

<ApplicationServer>
<Name>SP-APP1</Name>
<VhdName>SP-APP1</VhdName>
<InstanceSize>Medium</InstanceSize>
<VMImageName></VMImageName>
</ApplicationServer>
</ApplicationServers>

<!-- Database Servers -->
<DatabaseServers>
<AvailabilitySet>DB-AVSET</AvailabilitySet>
<SubnetName>BE-SUBNET</SubnetName>

<DatabaseServer>
<Name>SP-SQL1</Name>
<VhdName>SP-SQL1</VhdName>
<Type>Primary</Type>
<InstanceSize>Medium</InstanceSize>
<VMImageName>fb83b3509582419d99629ce476bcb5c8__Microsoft-SQL-Server-2012-Evaluation-CY13Feb-SQL11-SP1-CU2-11.0.3339.0</VMImageName>
</DatabaseServer>
</DatabaseServers>
</Machines>
</CloudService>
</Environment>

  • Run BuildADEnvironment.ps1 to create a affinity group, storage account, virtual network, cloud service and necessary VMs for AD environment defined in the environment configuration file.
  • Create a new Active Directory Forest in Windows Azure – Good resource for reference http://www.windowsazure.com/en-us/manage/services/networking/active-directory-forest/
    • RDP into the virtual machine
    • Initialize and mount the two data disks added, using the disk management tool. One is supposed to be used for LOGS and other for DATA
    • Add Role “Active Directory Domain Services”
    • Run DC Promo and create a new Active Directory Forest/Domain
    • Create an OU for virtual machines that will be provisioned and domain joined.
  • Before we can provision the virtual machines used for SharePoint farm we need to copy a base VHD I created ahead of time from a backup storage account to the new storage account created for this environment. VHDs for custom base images need to be in the same storage account, otherwise the VM provisioning will fail. For more details see this post on creating/reusing custom images in window azure.
  • Run BuildEnvironment.ps1 to create all the virtual machines for SharePoint farm. This script will prompt to enter the environment configuration file and the password that was initially used for domain Administrator account during step 2

From the screen shot below you can see all Virtual Machines are successfully provisioned and running

image

 

Screen shot below of my RDP window to “VMLAB-DC” shows the virtual machines are also domain joined to “vmlab.cloud” which is the domain that I created for the purposes of this post.

image

 

Finally screen shot of the RDP window to “SP-APP1” VM shows software and scripts required to provision a SharePoint farm. You could simply kick of the script to complete the SharePoint install and configuration.

image

 

Tear Down

In the tear down script we simply reverse everything we did, when the script is kicked off, it takes the environment configuration file as parameter and start tearing down the environment that was build out, nothing more to it. Some times I do have to run few times to fully clear everything out.

To wrap it up this really allows me to rapidly build and tear down SharePoint environments for vendors, develop teams etc. I’m really excited about Azure IaaS and the opportunities it brings and can’t wait for the feature to be out of preview :)

Final thing I will make all the scripts used in this post available so you can download and use it for your needs as well, if it helped you please feel free to drop a note and I appreciate it. I will just update this post after I’m able to package and publish the scripts.

Link to download scripts from TechNet script center

 http://gallery.technet.microsoft.com/PowerShell-Script-for-f43bb414

 

Cheers,

</Ram>

 

 

 

          
  • Ram, looking forward to the scripts. This looks like it could save people a ton of time!

Page 1 of 1 (1 items)