Pre-requisite:
These are few steps to be done prior to getting the User Profiles provisioned.
Steps to partition the User Profiles Service Application:
#######################################################################
# Steps to create the subscriptions and assigning the subscriptions to the sites
# Get the list of Sites in SharePoint - verify the above Web application URLs are listed.
Get-SPSite
# Get a reference to the first site
$site1 = Get-SPSite | where {$_.url -eq "http://sharepoint:91"}
$site1
# Get a reference to the second site
$site2 = Get-SPSite | where {$_.url -eq "http://sharepoint:92"}
$site2
# Creating 2 subscription objects, one for each site.
$sub1 = New-SPSiteSubscription
$sub1
$sub2 = New-SPSiteSubscription
$sub2
# Assign the subscription 1 and 2 to respective Sites [When prompted, press Enter to select the default option of "Y"].
Set-SPSite -Identity $site1 -SiteSubscription $sub1
Set-SPSite -Identity $site2 -SiteSubscription $sub2
# verify that the subscriptions are created and assigned correctly.
Get-SPSiteSubscription
# Create the User Profile Service Application in Partition Mode.
$userProfileSyncName = "Partitioned UP Synchronization Service"
# Replace mydatabaseserver with the name of your database server
$dbServerName = "mydatabaseserver"
# List all SharePoint application pools, chose an existing app pool for use by this User Profile Service Application. You may also chose to
# create a new Application pool if required.
Get-SPServiceApplicationPool
# I am going with using an existing application pool which shown as 'SharePointAppPool' in the list displayed by the above command
$AppPoolName = "SharePointAppPool"
$AppPool = Get-SPServiceApplicationPool -Identity $AppPoolName
# Create the new User Profiles Service Application, the DB names used are 'pProfileDB', 'pSocialDB' & 'pSyncDB'
$userProfileService = New-SPProfileServiceApplication -Name $userProfileSyncName -ApplicationPool $AppPool -ProfileDBServer $dbServerName -ProfileDBName "pProfileDB" -SocialDBServer $dbServerName -SocialDBName "pSocialDB" -ProfileSyncDBServer $dbServerName -ProfileSyncDBName "pSyncDB" -PartitionMode
# Create a User Profiles Service Application Proxy
New-SPProfileServiceApplicationProxy -Name "$userProfileSyncName Proxy" -ServiceApplication $userProfileService -DefaultProxyGroup -PartitionMode
Non-Partitioned User Profiles Management Page
Partitioned User Profiles Management Page
Note: The number of tenants is shown as 0. This means no subscriptions are assigned to this Service Application and that is what we need to do before attempting the Profile Import.
# Assign the 2 Subscriptions to the Partitioned User Profiles Service Application Proxy
#List all the Application Proxies
Get-SPServiceApplicationProxy
#Now from here pass the name of the "Partitioned" User Profile Service Application Proxy and store it in a variable
$pUPSP = Get-SPServiceApplicationProxy | ? {$_.DisplayName.Contains("Partitioned UP Synchronization Service Proxy")}
#Verify the object is correctly retrieved
$pUPSP
#Now add the two subscriptions ($sub1 & $sub2) created earlier to the User Profile Proxy object
Add-SPSiteSubscriptionProfileConfig -Identity $sub1 -ProfileServiceApplicationProxy $pUPSP
Add-SPSiteSubscriptionProfileConfig -Identity $sub2 -ProfileServiceApplicationProxy $pUPSP
#Assign the OUs for each subscription [Select the default value of "Y" when prompted].
Set-SPSiteSubscriptionProfileConfig -Identity $sub1 -ProfileServiceApplicationProxy $pUPSP -SynchronizationOU "UsersSet1"
Set-SPSiteSubscriptionProfileConfig -Identity $sub2 -ProfileServiceApplicationProxy $pUPSP -SynchronizationOU "UsersSet2"
# Create the Tenant Administration Sites for both the web applications
$tasite1 = new-spsite -url "http://sharepoint:91/sites/admin" -template "tenantadmin#0" -owneralias domain\user -sitesubscription $sub1 -AdministrationSiteType tenantadministration
$tasite2 = new-spsite -url "http://sharepoint:92/sites/admin" -template "tenantadmin#0" -owneralias domain\user -sitesubscription $sub2 -AdministrationSiteType tenantadministration
This concludes the partitioning steps for User Profiles Service Application.