,

SharePoint 2010 Multi-Tenant Hosting Part 2 “Configuring”

Posted by

Part 2 – Configuring Hosting


Configuring hosting requires powershell so the steps are all based off of using it.  The following steps take you through the process of setting up Multi-Tenant Hosting.   Before starting, create two site collections that reside within the same web application.  


1. Create a subscription and assign sites to it:


$sub = new-spsitesubscription


$sub  




 


2. Pulling the site collection or set of site collections you wish to join to the site group:


get-spsite


$site = get-spsite | where {$_.url -eq “http://contoso”}


$site



3. Add  the site collection $site, to the newly created site subscription $sub.



set-spsite -identity $site -sitesubscription $sub


Check whether it has been added correctly by doing the following:


get-spsitesubscription



If a database ID exists, then you can type the following


get-spdatabase | where-object {$_.id -match “full or partial guid”}


Will output the results of the associated site collection.



4. Create a secondary subscription and associate a different site collection within same web application for demonstration purposes using the steps above.





 


5. Create a SubscriptionSettings Service Application and Proxy


​A.  Start the WSS Subscription Settings Service


B. Create Service Application and Proxy via PowerShell


    $appPool  =  New-SPServiceApplicationPool -Name SettingsServiceApppool -Account domain\username


    $sa = new-spsubscriptionsettingsserviceapplication –Name SubscriptionSettingsServiceApplication –Databasename SubscriptionSettingsServiceApplicationDB –applicationpool appPool


    $sap = new-SPSubscriptionSettingsSericeApplicationProxy –ServiceApplication $sa






 


6. Creating the Tenant Admin Site for each site group


$sub = get-spsitesubscription –identity “http://server”


$tasite = new-spsite –url “http://Contoso/sites/tasite1” –template “tenantadmin#0” –owneralias domain\username –sitesubscription $sub -AdministrationSiteType tenantadministration





 


7. Provision a search service application in hosting mode.  Please see the Provisioning Search Service application using Powershell blog.




Note:  You must append the –Paritioned parameter to the following cmdlets.



  • new-spenterprisesearchserviceapplication

  • new-spenterprisesearchserviceapplicationproxy

From Powershell, run “get-help cmd-let –full” for more details.



 


8. Feature’s and hosting


Once a feature has been installed into the farm, it’s available to all sites and can be activated through manage features pages.  Simply stated, all installed\deployed features to a specified web application will be available to all sites that reside under the associated web application.  This applies to both non-hosted sites “sites that don’t belong to a site group” and hosted sites “Sites that are associated and are members of a particular site group.  A farm administrator is highly unlikely going to want all custom features to be available to every site group.  For Example, a custom feature might need to be deployed to sites under Site Group 1 and another custom feature must be deployed to sites under Site Group 2.   In a hosting scenario, if a feature is catered to a particular site group, a Farm Administrator will not want to expose those features to other site groups.


The way to control this in a hosting scenario is you only provide the features available to a given site group through a series of  PowerShell commands.  Any features not listed are excluded and not available for all site collections that belong to the corresponding site group. 


In order control or restrict what features are available to an associated site group “site subscription”, you can create what are called Feature packs. 


So the flow is the following:


1. Create a feature pack
2. Add features you want to be available for the associated site group
3. Assign the feature pack to the site group


Steps are the following:


A) Create a new site subscirption feature pack which creates a feature set limited to the specified site subscription.


$FP = new-spsitesubscriptionfeaturepack


 


B) Add the features you would like to add to the newly created subscription feature pack.


Get-spsitefeature


Copy the iD or id’s of the features you want.


For example: 830b81f9-e008-41f4-b3c3-9946b7eb3578


Drop it in a variable now:


$feature = get-spsitefeature 830b81f9-e008-41f4-b3c3-9946b7eb3578


 


C) Add the feature has a member of the featurepack you created in step 1.


Add-SPSiteSubscriptionFeaturePackMember -Identity $fp -FeatureDefinition $feature


To confirm it took run $fp


 


D) Assign the featurepack to the site group “SiteSubscription”


Set-SPSiteSubscriptionConfig -identity $sub1 -featurepack $fp


Note:  Be careful what features you decide to leave out.   Some features are required in order to successfully create sites.   For Example, if a featurepack only contains one custom feature and that feature pack is assigned to a site group, The tenant administrator will be unable to create sites via the Tenant Administration web site associated to that paritcular site group.  Also, any owners of sites that reside under the site group will be unable to create subsites.  The following error will persists within the ULS logs:


 


04/05/2010 10:42:02.75    w3wp.exe (0x12FC)    0x02C0    SharePoint Foundation    Runtime    tkau    Unexpected    System.InvalidOperationException: Failed to activate feature ‘BasicWebParts’ (id: ’00bfea71-1c5e-4a24-b310-ba51c3eb7a57′).  The feature is not a member of the associated site subscription feature pack.    at Microsoft.SharePoint.SPFeatureCollection.AddInternal(SPFeatureDefinition featdef, Version version, SPFeaturePropertyCollection properties, Boolean force, Boolean fMarkOnly)     at Microsoft.SharePoint.SPFeatureCollection.AddInternalWithName(Guid featureId, String featureName, Version version, SPFeaturePropertyCollection properties, Boolean force, Boolean fMarkOnly, SPFeatureDefinitionScope featdefScope)     at Microsoft.SharePoint.SPFeatureManager.EnsureFeaturesActivatedCore(SPSite site, SPWeb web, String sFeatures, Boolean fMarkOnly)     at Microsoft.SharePoint.SPFeatureManager.<>c__DisplayClassa.<EnsureFeaturesActivatedAtSite>b__9()     at Microsoft.SharePoint.SPSecurity.RunAsUser(SPUserToken userToken, Boolean bResetContext, WaitCallback code, Object param)     at Microsoft.SharePoint.SPFeatureManager.EnsureFeaturesActivatedAtSite(Byte[]& userToken, Guid& tranLockerId, Int32 nZone, Guid databaseid, Guid siteid, String sFeatures)     at Microsoft.SharePoint.Library.SPRequestInternalClass.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, String& bstrWebTemplate, Int32& plWebTemplateId)     at Microsoft.SharePoint.Library.SPRequest.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, String& bstrWebTemplate, Int32& plWebTemplateId)     at Microsoft.SharePoint.SPWeb.ApplyWebTemplate(String strWebTemplate)     at Microsoft.SharePoint.ApplicationPages.TA_CreateSiteCollection.BtnCreateSite_Click(Object sender, EventArgs e)     at System.Web.UI.WebControls.Button.OnClick(EventArgs e)     at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)     at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    c3b97351-e0bf-4351-a1bf-2e71c57fe2eb


 


Russ Maxwell, MSFT