This blog entry is some extended material from that book. I was working on Chapter 6, "Creating and Managing Service Applications" and wrote more material concerning Multi-Tenancy, Subscription Settings service, than the book's style requirements can support.
What this means is I had a section detailing pretty quickly how to create the subscription settings service application, create a subscription ID, create a site collection to use that ID, apply the ID to an existing site collection, create a feature packs, apply them, isolate the users for the tenant in their own OU, etc. Truly, I was supposed to do about a page per service application, and I ended up doing 8 pages for this one alone.
Oops.
So I had to trim the section to better match the intent of the chapter.
But, in case anyone reading the book would like to see this kind of detail, I am posting here. So:
How to create and manage the Subscription Settings Service Application in SharePoint Server and Foundation 2013 (note that in the final section listing the different service applications that can be partitioned, some of those do not apply to Foundation).
Create the Service Application and its proxy
Subscription Settings service obviously has several parts; the Service Application itself, its database (containing all the information concerning the subscription IDs), and its proxy. Interestingly, the service application does not have an association to connect (or not connect) the proxy to individual web applications. Once the service application is started and configured, it applies to the whole farm.
The subscriptions can also use their own Tenant Administration site template for the management of all of the site collections using the same subscription ID. When self-service site creation is enabled, the tenant administrator can create new site collections within the subscription. Feature packs (sets of specific features) are applied per subscription. So if a tenant has a number of site collections in the subscription, the feature pack will be applied to them all.
Here’s an example of how to create the Subscription Settings Service Application using PowerShell. In this case it will create a new service application pool (in my example the account is already a managed account), create the service application and its proxy. Remember to start the service instance on the Services on Server page in Central Administration.
$apppool= New-SPServiceApplicationPool –Name “SubSettingsAppPool” –Account “contoso\sp_ssacct”
$sapp= New-SPSubscriptionSettingsServiceApplication –Name “Subscription Settings Service” –DatabaseName “SubscriptionDB” –ApplicationPool $apppool
New-SPSubscriptionSettingsServiceApplicationProxy –ServiceApplication $sapp
The Subscription Settings Service will then show up in the Manage Service Applications, but will not have any manageable elements on that page. All management has to be done in PowerShell.
Generate a Subscription ID
Once the Subscription Settings Service Application is created, you can then generate subscription IDs. With an ID, you can create a tenant admin site collection, and, if the web application has self-service site creation enabled, the tenant can create additional site collections all using that subscription ID.
$sub= New-SPSiteSubscription
After you create the subscription ID (notice that I used a variable), you can apply it to new site collections.
Create a New Site Collection to use the Subscription ID
To create a new site collection that uses the subscription ID, you simply need to add the –SiteSubscription parameter and the GUID for the new subscription. Here’s an example, using only the required parameters (for simplicity’s sake) and the variable containing the new ID I created above :
New-SPSite –URL http://sharepoint.contoso.com/client1 –OwnerAlias contoso\clientadmin1 –Template STS#0 –SiteSubscription $sub
Apply the Subscription ID to an Existing Site Collection
If you need to apply the subscription ID to an existing site collection, to make it part of a tenant’s subscription, just use the Set-SPSite command with the –SiteSubscription parameter:
Set-SPSite –identity http://sitecollection.contoso.com –SiteSubscription $sub
Create a Tenant Administration Site Collection for the Subscription
To create a Tenant Administration site you specify the tenant admin template, and the administration site type:
New-SPSite –URL http://sharepoint.contoso.com/client1/admin -OwnerAlias contoso\clientadmin1 -OwnerEmail client1@contoso.com –Template TenantAdmin#0 –SiteSubscription $sub –AdministrationSiteType tenantadministration
The Tenant Administration site, as you can see in Figure 6-3, is a central location to manage the site collections and Service Applications for the Subscription.
Figure 6-3 Tenant Administration Site Home Page
It is on the home page of the Tenant Administration site that you configure the settings of the Service Applications that were configured to be partitioned (to support tenants). Each tenant can have their own isolated settings concerning Search, User Profile Service (use the OU unique to the tenant), Managed Metadata, Business Connectivity, and so on. If you have App Management configured for the farm it is automatically tenant aware (of course, since it requires Subscription Settings Service to operate), so tenants can have their own App Catalog and other App Management specific settings.
To manage and create new site collections, click the Manage Site Collections link under SharePoint Sites on the home page. It will take you to a page where you can manage existing site collections in the subscription and, if self-service site creation is enabled for the web application containing the subscription, create new ones (Figure 6-4). If you select an existing tenant site collection, you can use the Properties button to see the template used by the top level site, number of subsites, owner(s) of the site collection, site administrators, size and quota. The Owners button lets you see and change the site collection administrators for the selected tenant, and the Disk Quota button allows you to see and enter the disk quota settings for the tenant site collection.
Of course the Delete button is used to delete the selected tenant site collection, and the New button is used to create a new one. Remember that if you create host header managed paths, they will show up in the New Site Collection page.
Figure 6-4 Tenant Manage Site Collections page where you can manage, create or delete subscription site collections
Getting fancy- creating the host named site collections and their paths
New-SPManagedPath –RelativeURL “sales” –HostHeader –Explicit
Get-SPManagedPath -HostHeader
New-SPSite http://mysitecollection.contoso.com –OwnerAlias contoso\username –Name “My Very Own Site Collection” –Template “STS#0” –HostHeaderWebApplication http://servername
New-SPSite http://mysitecollection.contoso.com/sales -owneralias contoso\username -Name “MySalesSite” –Template STS#0 –HostHeaderWebApplication http:/servername
Create a Feature Pack
To control what features a tenant gets to use, you can create feature packs. Feature packs are explicitly applied to subscriptions, and override the default features available for the site collections using that subscription ID. Let me be clear, once you apply a feature pack, that defines all features used, removing those that aren’t in the pack- like the numerous features needed to simply have a site collection. So if you are going to do feature packs, keep that in mind. They are exclusive. Include everything you want the tenant site collections to be able to use, because anything not explicitly included, like Standard Site Collection features for example, will be excluded.
There are two methods to creating feature packs. One is to start empty, and individually add the features you want. But you’d be surprised how many features are required just for a basic site collection template to function. The other method is to get the features of a site you plan to use the most, or just all features scoped to sites or site collections, add those features, then start removing the ones you want to omit from the subscription. Also, if new features are made available on the farm for the tenant, you can add them to the feature pack applied to their subscription. All you need is the GUID or one word feature name for the feature.
The syntax to create a feature pack is:
$fp= New-SPSiteSubscriptionFeaturePack
Notice that I am using variables in these examples. I will be using them as holders for the objects being created so I can use them in later commands.
To add features to a feature pack, you can add them individually or in groups. The syntax for this command is to identify the features by GUID or feature name. It takes a surprising number of features to run a site collection. Conveniently, features are scoped, so you can pull all the features scoped to a single site or existing site collection into a variable and then remove the ones you don’t want the tenant to have. Something to bear in mind is that there can be two of each feature, one that is 14 compatible, and one that is 15 compatible. So many features have two versions. Generally, tenants on a SharePoint 2013 server are going to be using the SharePoint 2013 experience, so they can make use of all of its updated capabilities.
Manage a Feature Pack
When adding features, remember that you will need those scoped for both web (site) and site (site collection). So, to add all the features available for a particular site collection, you need to add both the site and site collection scoped features.
To add features from a particular site collection (they will be scoped to the correct compatibility level already):
That will get the site scoped features. To get the site collection scoped features:
Get-SPFeature –Site http://customer1.contoso.com | Add-SPSiteSubscriptionFeaturePackMember $fp
Or, if you don’t have a site collection you’d like to use as the base for your features, you can add all features on the farm scoped to a site at compatibility level 15 to a feature pack:
Get-SPFeature –limit all | Where Scope –eq Web | Where CompatibilityLevel –eq 15 | Add-SPSiteSubscriptionFeaturePackMember $fp
Of course that will only add site level features to the feature pack, so to then add the site collection features, like the commands above, change the word “Web” to the word “Site” and run command again.
These commands (whichever set you choose) will set you up with a functional feature pack that you can apply to a tenant. Keep in mind that the tenant admin site for the subscription will get these features, but will activate only those appropriate for its template.
Adding individual features to a feature pack can be a little tricky because the syntax of the command requires you use the feature ID to identify the individual feature. You can mark and paste it from the Get-SPFeature list (or look under the FEATURES folder in the correct hive for the one word feature name). The syntax of the cmdlet requires you specify the identity of the feature pack you are adding to (in my example I just refer to the variable I use when creating the feature pack), and the feature definition you are adding:
Add-SPSiteSubscriptionFeaturePackMember –identity $fp –FeatureDefinition
In some situations, tenants may be paying for a particular SharePoint license, and therefore may only be allowed to use features scoped for that license, such as those only for Foundation or Standard. There are lists online of the feature names for those licenses so you can use them to create features packs based on licensing. For example, there is a quick PowerShell script for creating a feature pack of SharePoint Foundation level features at: http://gallery.technet.microsoft.com/office/SharePoint-2013-Foundation-d3d1637f
Note that the feature you add may not be activated automatically. You should check to see if it is. The PowerShell cmdlet to activate a feature is:
Enable-SPFeature –Identity -url http://sitecollection.contoso.com
Or you can just log into the site collections and activate the features from the site settings pages instead.
If you want to add a feature to an existing feature pack, and you don’t have the feature pack’s ID number handy, you can use a site collection that uses that feature pack to specify the site subscription. Basically it gets the feature pack ID for that site collection’s subscription ID:
To remove a feature from a feature pack (this capability is important if you are using all the features available and then paring them down):
Remove-SPSiteSubscriptionFeaturePackMember –id -sitesubscription $fp
Applying a feature pack to a subscription uses a new cmdlet, Set-SPSiteSubscriptionConfig. This cmdlet lets you apply a feature pack to a subscription ID.:
Set-SPSiteSubscriptionConfig –Identity $sub –featurepack $fp
That command also has a parameter we will use later to isolate the subscription users to a particular OU in AD.
There is no easy command to remove a feature pack from a subscription, but you can simply apply a new one over the old one or complete delete a feature pack then apply a new one.
To delete a feature pack:
Remove-SPSiteSubscriptionFeaturePack –Identity $fp
Isolate the People Picker for a Subscription to an OU
To isolate a subscription’s people picker to only allow the display and selection of users from a specific OU you need to use the syntax of “OU=OUname,DC=DomainName,DC=DomainSuffix”. For example:
Set-SPSiteSubscriptionConfig –Identity $sub –UserAccountDirectoryPath “OU=customer1,DC=contoso,DC=com”
This capability is actually very cool and new to SharePoint 2013. By limiting the tenant to an OU, you can use User Profile Service (in partition mode, of course) to pull profiles from that OU only. There is an STSADM command that is the equivalent, and does not require that a site collection be part of a subscription (like the preceding PowerShell cmdlet does), which may be even cooler.
The STSADM command to limit the people picker of a site collection to one OU specifies the OU in AD, and the URL of the site collection:
STSADM –o SetSiteUserAccountDirectoryPath –Path “OU=sales,DC=contoso,DC=com” –URL http://sales.contoso.com
To see more of the cool things you can do with STSADM and the peoplepicker, such as specifying an AD directory path to point to more than one OU, see http://technet.microsoft.com/en-us/library/gg602075.aspx
Adventures in Provisioning Service Applications to be consumed by Tenants
When considering partitioned service applications for tenants, remember that they are applied via associations with the web application that contains them. This is why it is considered best practice (and common sense, which is often what best practice truly is) to keep the tenants in their own web application.
I hope this material was useful for you. Thanks for reading!

