Setup a SharePoint Development Environment Part 4

This is the 4th series of my post on how to set up a SharePoint Hyper-V virtual farm. In the previous posts we prepared our different servers, installed SQL and SharePoint 2013. In this post we will configure SharePoint 2013 with PowerShell. Like i already said in the previous post there will be some benefits of doing it this way. If you use the standard configuration setup wizard then SharePoint will create the databases and services for you. This also means that you don’t have control over their names, passwords or the accounts they run under.

Open the SharePoint 2013 Management Shell.

image Now run the following commands. (All the commands below are using the users, passwords and names that i choose. If you want you can change them to whatever you like)

$cred_farm = New-Object System.Management.Automation.PsCredential "S_SPfarm",(ConvertTo-SecureString "<password>” -AsPlainText -Force)
$SecPhrase = ConvertTo-SecureString "<securePassPhrase>" -AsPlainText –Force
New-SPConfigurationDatabase –DatabaseName "SP2013_Config" –DatabaseServer "SHP_SQL" –AdministrationContentDatabaseName "SP2013_Content_AdminSite" –Passphrase $SecPhrase –FarmCredentials $Cred_Farm
Install-SPHelpCollection –All
Initialize-SPResourceSecurity
Install-SPService
Install-SPFeature –AllExistingFeatures -Force
New-SPCentralAdministration -Port "9000" -WindowsAuthProvider "NTLM"
Install-SPApplicationContent

 

After running these commands the basic SharePoint configuration is done and the Central Administration site is provisioned on port 9000.

Now its time to register the managed accounts These accounts will be used during the further configuration. Enter the following PowerShell command to get a popup where you can enter the different credentials of the accounts. Repeat this command for every account. Use the setup accounts we created in the second post.

image You can check the managed accounts you entered in Central Administration (Security – Configure managed accounts). When executing these commands have some patience. They take some time even after the commands are executed. 🙂

image

Now lets create the different application pools. Keep the PowerShell command line window open and execute the following commands.

$ManagedAccount = Get-SPManagedAccount -Identity "rd\S_SPservice"
New-SPServiceApplicationPool "SPS2013_Common" -account $ManagedAccount
$ManagedAccount = Get-SPManagedAccount -Identity "rd\S_SPsearch"
New-SPServiceApplicationPool "SPS2013_Search" -account $ManagedAccount
$ManagedAccount = Get-SPManagedAccount -Identity "rd\S_SPadsync"
New-SPServiceApplicationPool "SPS2013_UPS" -account $ManagedAccount

 

Outgoing E-mail

If you created an SMTP server feature like in the first post you can do this step. Otherwise you can skip this.

Go in Central Administration to System settings => Configure outgoing mail settings. Here you can fill in the SMTP server details.

image

Service Applications 

Now it’s time to create the service applications. You can create them thru Central Administration => Manage service applications. Give them a correct name and database. For the application pool use the SPS2013_Common that we created. The ones you need are the Managed Metadata, Secure Store, and Business Connectivity.

Except the State Service application. This must be activated with the following PowerShell commands.

$ServiceApp = New-SPStateServiceApplication -Name "State Service Service Application"
New-SPStateServiceDatabase -DatabaseServer "SHP_SQL" -Name "SP2013_StateService" -ServiceApplication $ServiceApp
New-SPStateServiceApplicationProxy -Name "State Service Application Proxy" -ServiceApplication $ServiceApp -DefaultProxyGroup
Enable-SPSessionStateService -DatabaseServer "SHP_SQL" -DatabaseName "SP2013_SessionStateService"

After you’ve created these 4 service applications start the first 3 thru Central Administration => Application Management => Manage services on server.

Create Web applications

Now we can start creating our web applications. Create one for a SharePoint site that well use for developing of giving demo’s and of course one for all the mysites.

image image

image image

Don’t forget to set the browser file handling to Permissive after you’ve created the web application. Repeat this also for the MySites.

Now create in both web applications a site collection. For the MySites use the MySite Host Template.

Search

The Search Service application will be created using PowerShell (what else 🙂 ). You can use this script but don’t forget to adjust it to your environment names.

Add-PSSnapin Microsoft.SharePoint.PowerShell 

## Change these per your environment ##
$databaseServerName = "shp_sql"
$searchServerName = "SP2013"
$saAppPoolName = "SP2013_Search"
$appPoolUserName = "rd\SHP_Search"
$IndexLocation = "D:\SP2013Search"
## Service Application Names ##
## Included Usage and Health, as it does get provisioned and if you want to define DB name ##
## Also Usage Proxy Status is stopped which cause Search Application Topology to not find Admin Service ##
$searchSAName = "SharePoint Server Search"
$usageSAName = "Usage and Health Data Collection Service"

$saAppPool = Get-SPServiceApplicationPool -Identity $saAppPoolName 
if($saAppPool -eq $null)
{
  Write-Host "Creating Service Application Pool..."

  $appPoolAccount = Get-SPManagedAccount -Identity $appPoolUserName 
  if($appPoolAccount -eq $null)
  {
      Write-Host "Please supply the password for the Service Account..."
      $appPoolCred = Get-Credential $appPoolUserName
      $appPoolAccount = New-SPManagedAccount -Credential $appPoolCred 
  }

  $appPoolAccount = Get-SPManagedAccount -Identity $appPoolUserName 

  if($appPoolAccount -eq $null)
  {
    Write-Host "Cannot create or find the managed account $appPoolUserName, please ensure the account exists."
    Exit -1
  }

  New-SPServiceApplicationPool -Name $saAppPoolName -Account $appPoolAccount  > $null
	
}


Write-Host "Creating Usage Service and Proxy..."

$serviceInstance = Get-SPUsageService

New-SPUsageApplication -Name $usageSAName -DatabaseServer $databaseServerName -DatabaseName "SP2013_UsageDB" -UsageService $serviceInstance > $null

$usa = Get-SPServiceApplicationProxy | where {$_.TypeName -like "Usage*"} 
$usa.Provision()

To ensure that SharePoint can crawl itself we must disable the loopBackCheck. More info on this can be found here. In a nutshell all you have to do is startup the registry editor by running “regedit”. Locate the following key: “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa”
add a DWORD value “DisableLoopBackCheck” and modify its value to 1. After this a reboot is required.

User Profile Service

Create the User Profile service like you’ve created the others thru Central Admin. Give the correct database names and select the search application pool. After it’s created start up the User profile search and synchronization services on the “Manage Services on server” page. The synchronization service will ask for the credentials of the farm account. After you’ve entered them it will take some time to start. After it’s started you must reset IIS.

image

To configure the user profile synchronisation go in Central Admin to “Application Management” =>Manage Service Applications and open the User Profile Service application you just created. Click on “Configure a Synchronization connection”

imageNow lets create a new connection. Fill in the correct info. Give your connection a name. Choose Active Directory and fill in your Forrest name. Just let it auto discover the Domain Controller. The account we will use for the sync is S_SPadsync. Keep the standard port and press the populate containers button. If everything goes well you should see your domain. Press select all and where good to go.

image If you want you can add some connection filters like to exclude the disabled users. Because this is a development environment we will not add any filters. If we need them we’ll add them later. Now go back to the User Profile Service application and configure the Synchronization Timer Job. Choose a schedule you like and enable the Timer Job.

image Now when you go back to the User Profile Service Application you can start a full synchronization for the first time. To allow the search account to find users you should go back to the Manage services on server page and select the User Profile Service Application. Here you can set the administrators for the application. Here you should add the search account so it can retrieve user info.

image

Go to the User Profile Service Application page and open Manage User Permissions. If you want you can change here which users have permission to have a MySite.

If you want you can create other service applications to but there are for me the basics you must have.

Just one more PowerShell Script left. This is to integrate the workflowmanager with SharePoint.

 

Register-SPWorkflowService –SPSite "http://SP2013.RD.local/" –WorkflowHostUri "http://localhost:12290/" –AllowOAuthHttp

Leave a Reply

Your email address will not be published. Required fields are marked *