Friday, February 10, 2017

Convert Classic To Claims Mode Authentication SharePoint 2013

Your SharePoint 2013 users may get Access Denied while accessing a web application which is just got migrated from SharePoint 2010 environment. Mostly this happens due to change in authentication modes as classic mode authentication has been deprecated in SharePoint 2013. Although you can create a classic mode web application using SharePoint Management Shell.

This script will work on SharePoint 2013 environment where you have a classic mode web application migrated from SharePoint 2010 or MOSS 2007.

Note: If you have more than one Content Databases attached with single web application and you are migrating databases one by one, you have to run this script each time you finish your database migration on SharePoint 2013 environment. This is what i have learned from my recent migration work.

[code]Convert-SPWebApplication -Identity "http://webapplicationurl" -From Legacy -To Claims -RetainPermissions -Force[/code]

Full code with user input and logs. This will export a log file as well.

[code]
$currentTime = Get-Date -Format o | foreach {$_ -replace ":", "."}
New-Item $PSScriptRoot\ConvertClassicToClaims-$currentTime.txt -type file
Start-Transcript -Path "$PSScriptRoot\ConvertClassicToClaims-$currentTime.txt"
$WebApplicationUrl = Read-Host "Please provide Web Application URL"
$wa = Get-SPWebApplication $WebApplicationUrl
Convert-SPWebApplication -Identity $wa -To Claims -RetainPermissions -Force
Stop-Transcript
[/code]

No comments:

Post a Comment