Friday, 18 October 2013

CREATING A SHAREPOINT 2013 FARM USING SQL ALIASES, FROM POWER SHELL


You may be very well used to creating your SharePoint farm simply by running configuration wizard.

Here is a way to create it using PowerShell, and an already created SQL Server Alias.


1.  Open SharePoint 2013 management shell as administrator.
2.  You will see this error message at the top: “The local farm is not accessible. 
     Cmdlets with FeatureDependencyId are not registered.” Do not panic. This is expected because a                farm has not yet been created.

3.  Type in the following PowerShell command at the prompt, and press enter
“New-SPConfigurationDatabase -DatabaseName SharePoint_Config -DatabaseServer MSSQLSERVERTEST_ALIAS -AdministrationContentDatabaseName SharePoint_Admin_Content”
Where MSSQLSERVERTEST_ALIAS is the sql server alias you would have created on your SharePoint server
NB: Change the databsase server name to the name of the database alias you have created.
Check here on howto create SharePoint SQL server database aliases.

4.  You would be immediately prompted to enter your farm credentials. This credentials are the a                       account you want as farm admin account. For me it’s sp_farm.

 5.  Next you will be prompted for passphrase. Clear the existing ****************** which you see(if it       pops up), and enter any value you wish as your passphrase. Remember it well, as it would be 
       needed should you have cause to join another server to the farm.

You may get an error stating
“Cannot connect to database master at sql server < MSSQLSERVERTEST_ALIAS> { ie  <ServerAliasName>. The database might not exist, or current user might not have permission to connect to it.



If you get this error, continue with step 6. Else proceed to steps 10

6.  Try to verify that the error has nothing to do with your PowerShell commands, try creating the farm 
            using SharePoint configuration wizard.

 7.  If the error persists, then check that your alias was created properly. Check here on how to createSharePoint SQL server database aliases.
8.  If the SQL Aliasing part is ok, then confirm that the account you are creating the farm with, which                 you must have also installed SharePoint with (now this is not the account you provided as farm admin            account, but the account you ), which is “adminsp” in my case, has the following permissions in the                database server “dbcreator”, ”security admin”. Go to your sql server, connect to your instance, and          expand Security > Logins, then right click on this account, select server roles. Then give the appropriate        permissions.






9.  If this is in place, and the error still persists, ensure that you don’t have firewall turned on. If they                   are, create a windows firewall rule on you sql server. Go to your Windows firewall on your SQL                   server, on the left, click on ”advanced settings”. Select “Inbound Rules” > “new rule”. For the rule type,         select “port”. For the Protocol and ports, Select TCP, then enter your sql specific port number. Action,         select “Allow this port number”. Select the profile, then Give the rule a name that you can remember.


10.  With all these in place, you should be OK with proceeding with your farm creation. This should create 2         database tables for you “SharePoint_Config” and “SharePoint_Admin_Content”.

11.  When your PS commands are done with the farm creation, the cursor would return to its blinking state.

     12.  Next, open SharePoint 2013 products configuration wizard and run the wizard. When prompted for port       number, specify the port number you want for your SharePoint central administration and select NTLM         Authentication.

No comments:

Post a Comment