What is Tenant Provisioning and Management in SharePoint

To create a tenant, follow the steps in the table.

1. Create a site subscription.

$sub = New-SPSiteSubscription
Set-SPSiteSubscriptionConfig -id $sub -FeaturePack $customerFeatures -UserAccountDirectoryPath “OU=$customerName,OU=Customers,DC=contoso,DC=com”

2. Assign a feature pack to the site subscription and configure custom OU by using People Picker.

Write-Host “Creating Member Site…”
New-SPSite -url “http://$customerName.contoso.com”; -SiteSubscription $sub -HostHeaderWebApplication $webApp -owneralias $customerTenantAdmin -owneremail $customerTenantAdminEmail -template sts#0 -ContentDatabase $contentDBName

3. Create one or more site collections to be assigned to the site subscription.




# create Tenant Admin site
Write-Host “Creating Tenant Admin site…”
New-SPSite -url “http://$customerName.contoso.com/admin”; -SiteSubscription $sub -HostHeaderWebApplication $webApp -owneralias $customerTenantAdmin -owneremail $customerTenantAdminEmail -template tenantadmin#0 -AdministrationSiteType TenantAdministration -ContentDatabase $contentDBName

Write-Host “Creating My Site Host…”
New-SPSite -url “http://$customerName.contoso.com/mysites”; -SiteSubscription $sub -HostHeaderWebApplication $webApp -owneralias $customerTenantAdmin -owneremail $customerTenantAdminEmail -template SPSMSITEHOST#0 -ContentDatabase $contentDBName

The following Windows PowerShell script shows how to create a tenant admin site that uses the TENANTADMIN#0 template. If the tenant is configured to use an Enterprise Feature Pack, the Windows PowerShell script performs additional operations, that is, it creates the My Sites collection.
Add-PSSnapin Microsoft.SharePoint.Powershell -EA 0

# farm details (update to reflect your environment)
$hostingMainURL = “http://$ENV:COMPUTERNAME”;
$upaProxyName = “Tenant User Profile Service Proxy”
$mmsProxyName = “Tenant Managed Metadata Service”
$contentDBName = “HostingFarm_Content_Hosting”

$farm = Get-SPFarm
$foundationFeaturePack = $farm.Properties.Foundation_FeaturePack
#$standardFeaturePack = $farm.Properties.Standard_FeaturePack
#$enterpriseFeaturePack = $farm.Properties.Enterprise_FeaturePack

# tenant-specific information (vary by tenant)
$customerName = “Customer A”
$customerTenantAdmin = “CONTOSO\customerA-Admin”
$customerTenantAdminEmail = “admin@customerA.com
$customerFeatures = $enterpriseFeatures
# Note:
# this script assumes that the Content Web App and necessary Managed Paths exist.




# grab the web app
$webApp = Get-SPWebApplication $hostingMainURL

# create new Site Subscription
Write-Host “Creating Site Subscription…”
$sub = New-SPSiteSubscription

# assign feature pack and set the OU to be used by the People
Write-Host “Assigning Feature Pack and configuring People Picker…”
Set-SPSiteSubscriptionConfig -id $sub -FeaturePack $customerFeatures -UserAccountDirectoryPath “OU=$customerName,OU=Customers,DC=contoso,DC=com”

# create the “main” member site (we need a site at the root to use Host Headers and Managed Paths in the following cmdlets)
Write-Host “Creating Member Site…”
New-SPSite -url “http://$customerName.contoso.com”; -SiteSubscription $sub -HostHeaderWebApplication $webApp -owneralias $customerTenantAdmin -owneremail $customerTenantAdminEmail -template sts#0 -ContentDatabase $contentDBName




# create Tenant Admin site
Write-Host “Creating Tenant Admin site…”
New-SPSite -url “http://$customerName.contoso.com/admin”; -SiteSubscription $sub -HostHeaderWebApplication $webApp -owneralias $customerTenantAdmin -owneremail $customerTenantAdminEmail -template tenantadmin#0 -AdministrationSiteType TenantAdministration -ContentDatabase $contentDBName

# everything else needs standard
if (!($customerFeatures -eq $foundationFeatures))
{
Write-Host “Tenant has SharePoint Server features”
# create a mysite host
Write-Host “Creating My Site Host…”
New-SPSite -url “http://$customerName.contoso.com/mysites”; -SiteSubscription $sub -HostHeaderWebApplication $webApp -owneralias $customerTenantAdmin -owneremail $customerTenantAdminEmail -template SPSMSITEHOST#0 -ContentDatabase $contentDBName

# configure the MySites host, MySites path, Naming Resolution and Profile Sync OU for the Subscription
Write-Host “Configuring Tenant Profile Config…”
$upaProxy = Get-SPServiceApplicationProxy | where-object {$_.DisplayName -eq $upaProxyName}
Add-SPSiteSubscriptionProfileConfig -id $sub -SynchronizationOU $customerName -MySiteHostLocation “http://$customerName.contoso.com/mysites”; -MySiteManagedPath “/mysites/personal” -SiteNamingConflictResolution “None” -ProfileServiceApplicationProxy $upaProxy

# create a site for the Content Type Gallery
Write-Host “Creating Content Type Gallery…”
New-SPSite -url “http://$customerName.contoso.com/cthub”; -SiteSubscription $sub -HostHeaderWebApplication $webApp -owneralias $customerTenantAdmin -owneremail $customerTenantAdminEmail -template sts#0 -ContentDatabase $contentDBName

# configure the Content Type Gallery for the Subscription
Write-Host “Configuring Tenant Content Type Gallery…”
$mmsProxy = Get-SPServiceApplicationProxy | where-object {$_.DisplayName -eq $mmsProxyName}
# ContentTypeHub feature activation may fail – if so activate manually
Set-SPSiteSubscriptionMetadataConfig -identity $sub -serviceProxy $mmsProxy -huburi “http://$customerName.contoso.com/cthub”; -SyndicationErrorReportEnabled
Write-Host “Activating Content Type Hub…”
Enable-SPFeature -Identity ContentTypeHub -url “http://$customerName.contoso.com/cthub”;
}

Write-Host “Tenant Provisioning Script Completed!”

This approach can be further customized to contain other tenant configuration such as for Workflow, Apps and IRM. Generally such script is encapsulated into a function or custom cmdlets which enables it to be run repeatedly for future tenants.




Subscribe to daily updates!

Be Connected…

Satyendra

,

About Satyendra Mishra

Satyendra is a Technical Project Manager with 12+ years of experience on Project Management, Microsoft Technologies including ASP.NET, ASP.NET MVC, C#, SharePoint (On premises & Office 365), JavaScript Framework (AngularJS) and related technologies. He is a person with belief, sky is limit for a hard working and dedicated individual. That’s why he devoted himself to field of Software Development and now both are growing with each other. Every year for him turned out to be best year and he received enormous support and love from his companies and his clients from around the world. Now with vast knowledge of software development and its outsourcing process, he decided to move himself into knowledge sharing. Keep a fact in your mind about the comfort level of your clients and this will make you king/queen of your area.
View all posts by Satyendra Mishra →

Leave a Reply

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