Access is denied while creating Search Center in SharePoint 2013

I am currently working on an automated installation script for SharePoint 2013 when I received the following issue while creating a Search Center.

Search Center

I have created the site collection after I have configured the SuperUser and SuperReader account. I use the following code to set the accounts in SharePoint and configure them as ‘Super Accounts’:

$SuperUserAcc = "sp2013p_superuser"
$SuperReaderAcc = "sp2013p_superreader"
$webapps = Get-SPWebApplication </span><span style="font-size: xx-small;">foreach($webapp in $webapps) { </span><span style="font-size: xx-small;">[Microsoft.SharePoint.Administration.SPPolicyCollection]$policies = $webapp.Policies
[Microsoft.SharePoint.Administration.SPPolicy]$policy = $policies.Add($SuperUserAcc, "Super User (Object Cache)")
[Microsoft.SharePoint.Administration.SPPolicyRole]$policyRole = $webapp.PolicyRoles | where {$_.Name -eq "Full Control"}
$policy.PolicyRoleBindings.Add($policyRole) </span><span style="font-size: xx-small;">[Microsoft.SharePoint.Administration.SPPolicy]$policy = $policies.Add($SuperReaderAcc, "Super Reader (Object Cache)")
[Microsoft.SharePoint.Administration.SPPolicyRole]$policyRole = $webapp.PolicyRoles | where {$_.Name -eq "Full Read"}
$policy.PolicyRoleBindings.Add($policyRole) </span><span style="font-size: xx-small;">$webapp.properties["portalsuperuseraccount"] = $SuperUserAcc
$webapp.properties["portalsuperreaderaccount"] = $SuperReaderAcc
$webapp.Update() 

You will have to add the SuperUser and SuperReader with the Claims Based prefix “i:0#.w|<Domain>” to be able to create a search center in SharePoint 2013.

$SuperUserAcc = " i:0#.w|<Domain>\sp2013p_superuser"
$SuperReaderAcc = " i:0#.w|<Domain>\sp2013p_superreader"

Leave a Reply

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