Wednesday, February 18, 2015

Access is denied - SharePoint 2013 search crawl

Error Message : Access is denied. Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository. If the repository being crawled is a SharePoint repository, verify that the account you are using has “Full Read” permissions on the SharePoint Web Application being crawled. ( Error from SharePoint site: HttpStatusCode Unauthorized The request failed with HTTP status 401: Unauthorized. )

Context: Application 'Search Service Application', Catalog 'Portal_Content'

Details: Access is denied. Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository. If the repository being crawled is a SharePoint repository, verify that the account you are using has "Full Read" permissions on the SharePoint Web Application being crawled. (0x80041205)

Solution: Add Default Content Access Account for Search in your web application

Add-PSSnapin Microsoft.sharepoint.powershell
$userName = "<Domain\SearchAccount>" 
$displayName = "Search Crawl Account" 
Get-SPWebApplication https://mywebApplicationUrl | foreach { 
$webApp = $_ 
$policy = $webApp.Policies.Add($userName, $displayName
$policyRole = $webApp.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullRead) 
$policy.PolicyRoleBindings.Add($policyRole
$webApp.Update() 
}


It should fix the issue.