Monday, October 21, 2013

Creating instances for a SharePoint 2013 Windows Azure farm

Unfortunately, Microsoft has decided that you can not install SharePoint 2013 on a domain controller.  This has the unfortunate side effect of mandating that you have at least 2 virtual machines running in order to create a SharePoint 2013 development environment.  ​This post will cover the steps needs for creating a 2 server instances for the SharePoint 2013 development.  One instance will be a simple domain controller.  The other instance will the more traditional server which will contain the production you wish to use for doing your SharePoint development.  This post will NOT cover installing SharePoint or SQL Server or setting up a domain controller.  This post will discuss how to setup the 2 instances in Windows Azure.
This post assumes you already have Windows Azure PowerShell installed locally with the subscription settings and a storage account setup.  If you do not have that already done, then you can view my Getting started with Microsoft Windows Azure PowerShell post for instructions on how to accomplish that.  
  

Script file and Network Config XML for your Domain Controller

Here are the contents of my CreateDC.ps1 script, which I used to create a new Windows Azure instance that will become my domain controller. 
 
$moduleLocation = "C:\Program Files (x86)\Microsoft SDKs\Windows Azure\PowerShell\Azure\Azure.psd1"
$publishSettingsLocation = "<C:\Users\<UserProfile>\Downloads\<SubscriptionName>-credentials.publishsettings>"
$subscriptionName = "Visual Studio Premium with MSDN"
$storageAccountName = "<StorageAccountName>"
$affinityGroup = "<AffinityGroupName>"
$myWindowsAdminPassword = '<local admin account password>'
 
#This will need to unique within this Azure service
$rdpPort = '<the port to use form RDP acccess to this box>'

$myAzureVNetXML = "C:\Azure\scripts\NetworkConfig.xml"
 
#If you rerun the script, you need to supply a unique value for $dcServiceName
$vmname = 'DC1'
 
#This name will need to be unique for Windows Azure, so you may want to make
#this name fairly unique
$dcServiceName = '<service name>'     

$vnet = 'Sp2013VN'

#Import-Module $moduleLocation
#Import-AzurePublishSettingsFile $publishSettingsLocation
Set-AzureSubscription -SubscriptionName $subscriptionName -CurrentStorageAccount $storageAccountName
Select-AzureSubscription -SubscriptionName $subscriptionName

#Create the virtual network based on the settings in the XML file at this path
# note the $affinityGroup, $vmname and $vnet values must those in the NetworkConfile.xml file.
Set-AzureVnetConfig -ConfigurationPath $myAzureVNetXML

# OS Image to Use.  This valus comes from the list of disk images that are
#available.
$image = "a699494373c04fc0bc8f2bb1389d6106__Win2K8R2SP1-Datacenter-201305.01-en.us-127GB.vhd"
 
#VM Configuration
$MyDC = New-AzureVMConfig -name $vmname -InstanceSize 'Small' -ImageName $image |
    Add-AzureProvisioningConfig -Windows -AdminUsername $myWindowsAdminName -Password $myWindowsAdminPassword|
    Set-AzureSubnet -SubnetNames 'Subnet-1' |
    Remove-AzureEndpoint –Name "RDP" |
    Add-AzureEndpoint -LocalPort 3389 -Name 'RDP' -Protocol tcp -PublicPort $rdpPort

New-AzureVM -ServiceName $dcServiceName -AffinityGroup $affinityGroup -VMs $MyDC -VNetName $vnet 
 
 And, here is the contents of the NetworkConfig.xml file mentioned in the above post.
<NetworkConfiguration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/ServiceHosting/2011/07/NetworkConfiguration">
  <VirtualNetworkConfiguration>
    <Dns>
      <DnsServers>
        <DnsServer name="Sp2013DC" IPAddress="10.0.0.4" />
      </DnsServers>
    </Dns>
    <VirtualNetworkSites>
      <VirtualNetworkSite name="Sp2013VN" AffinityGroup="<AffinityGroupName>">
        <AddressSpace>
          <AddressPrefix>10.0.0.0/8</AddressPrefix>
        </AddressSpace>
        <Subnets>
          <Subnet name="Subnet-1">
            <AddressPrefix>10.0.0.0/11</AddressPrefix>
          </Subnet>
        </Subnets>
        <DnsServersRef>
          <DnsServerRef name="Sp2013DC" />
        </DnsServersRef>
      </VirtualNetworkSite>
    </VirtualNetworkSites>
  </VirtualNetworkConfiguration>
</NetworkConfiguration>
 

Execute the CreateDC PowerShell script

To execute the script file,  ...
 
  1. Open the Windows Azure PowerShell console as Administrator. 
  2. Change directory, CD, to the folder containing the script.  Example CD c:\MyScripts
  3. Enter in the script filename .\CreateDC.ps1
After a several moments, you will have a new Windows Azure service called <service name> that contains 1 virtual machine that will become the domain controller.  You will be able to remote desktop into the domain controller by using <service name>.cloudapp.net:<the port to use form RDP acccess to this box>
 
You will need to remote into that server and promote it to be a domain controller before adding additional virtual machines to this service.
  

Create SharePoint server instance

Here are the contents of my CreateSP.ps1 script, which I used to create a new Windows Azure instance that will become my SharePoint development server.  This virtual machine will be added to the virtual network that I created in the previous steps. 
 
$moduleLocation = "C:\Program Files (x86)\Microsoft SDKs\Windows Azure\PowerShell\Azure\Azure.psd1"
$publishSettingsLocation = "<C:\Users\<UserProfile>\Downloads\<SubscriptionName>-credentials.publishsettings>"
$subscriptionName = "Visual Studio Premium with MSDN"
$storageAccountName = "<StorageAccountName>"
$affinityGroup = "<AffinityGroupName>"
$myWindowsAdminName = '<local admin account name>'
$myWindowsAdminPassword = '<local admin account password>'
$vmname = 'SP2013'
 
#This will need to unique within this Azure service
$rdpPort = '<the port to use form RDP acccess to this box>'
#use the same service name and virtual network name that you used to create your domain controller
$serviceName = '<service name>'
$vnet = '<virtual network>'


Import-Module $moduleLocation
Import-AzurePublishSettingsFile $publishSettingsLocation
Set-AzureSubscription -SubscriptionName $subscriptionName -CurrentStorageAccount $storageAccountName
Select-AzureSubscription -SubscriptionName $subscriptionName
 
 
# OS Image to Use
$image = "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-Datacenter-201306.01-en.us-127GB.vhd"

#VM Configuration
$MyDC = New-AzureVMConfig -name $vmname -InstanceSize 'Medium' -ImageName $image |
         Add-AzureProvisioningConfig -Windows -AdminUsername $myWindowsAdminName -Password $myWindowsAdminPassword|
         Set-AzureSubnet -SubnetNames 'Subnet-1' |
         Remove-AzureEndpoint –Name "RDP" |
         Add-AzureEndpoint -LocalPort 3389 -Name 'RDP' -Protocol tcp -PublicPort $rdpPort

New-AzureVM -ServiceName $serviceName -VMs $MyDC -VNetName $vnet
 

Execute the CreateSP PowerShell script

To execute the script file,  ...
 
  1. Open the Windows Azure PowerShell console as Administrator. 
  2. Change directory, CD, to the folder containing the script.  Example CD c:\MyScripts
  3. Enter in the script filename .\CreateSP.ps1
After a several moments, you will have a new virtual machine created within the Windows Azure service called <service name>.  This server become your SharePoint server.  You will be able to remote desktop into the virtual machine by using <service name>.cloudapp.net:<the port to use form RDP acccess to this box>.
 
 

No comments:

Post a Comment