I have recently been tasked to investigate the setup of a cloud based, multi-tenancy SharePoint 2010 farm that runs on MS SQL 2012. I found Spencer Harbar’s excellent article Rational Guide to Multi Tenancy with SharePoint 2010 and I was able to work my way through the series of articles and scripts. Everything worked perfectly except for an error that I received when setting up the individual tenants. The PowerShell error is as follows:
Add-SPSiteSubscriptionProfileConfig : Object reference not set to an instance of an object.
At C:\Scripts\PowerShell6_provision_tenants.ps1:83 char:44
+ Add-SPSiteSubscriptionProfileConfig <<<< -id $sub -SynchronizationOU $customerName -MySiteHostLocation “http
://$customerURL/mysites” -MySiteManagedPath “/mysites/personal” -SiteNamingConflictResolution “None” -ProfileServiceApp
+ CategoryInfo : InvalidData: (Microsoft.Offic…ddProfileTenant:SPCmdletAddProfileTenant) [Add-SPSiteSub
+ FullyQualifiedErrorId : Microsoft.Office.Server.UserProfiles.PowerShell.SPCmdletAddProfileTenant
I spent a lot of time trying to determine where the missing object reference was. Having checked all input variables and after adding several Start-Sleep statements throughout the script, it became apparent that the issue was outside of variable and site provisioning issues.
We then started checking log files but there was nothing apparent in either the SharePoint or the Windows event logs. By chance we spotted an error concerning permissions when attempting to open the Business Data Connectivity Service Application from within Central Admin. We has been using the SharePoint Setup account to run the scripts and so decided to try the SharePoint Farm account. The script ran without error and completed successfully.
The upshot is that if you plan to run any of Spencer’s PowerShell scripts to create your multi-tenancy environment, then you should grant local Administrator rights on your machine to the SharePoint Farm account and then run all the scripts under this account name.
Hopefully this will save you a few hours of debug time