Enabling or Disabling Claims Based Authentication
Claims Based Authentication is becoming so popular these days and enabling a SharePoint site to authenticate users no matter what authentication system is involved just got easier. I will not digress on Claims Based Authentication, not the point of this article, but I will focus on how to enable or disable CBA using PowerShell since there is no GUI available for this trick.
First, make sure your site (web application) does not have the CBA enabled. Go to Central Administration >> Manage web applications and click on the site you’re planning to enable CBA. Under Web Applications tab click on the Authentication Providers icon and a small window will pop-up. Under Default you should see Windows.
Next, create a PowerShell (.ps1) file using Notepad and paste the following code into it:
$setcba = Get-SPWebApplication "http://YourSiteURL" $setcba.UseClaimsAuthentication = 1; $setcba.Update() |
Give it a name, like SetCB.ps1 and save in under C: on your SharePoint 2010 server.
Open SharePoint 2010 Management Shell, make sure you’re under C: (use CD.. to move under C:)and type or Copy and right-click Paste this command ./SetCB.ps1
Hit Enter and after few seconds your SharePoint site should have Claims Based Authentication enabled.
Repeat the previous steps to check if your site has CBA enabled, Central Administration >> Manage web applications and click on the site, click on the Authentication Providers icon and under Default you should see now Claims Based Authentication.
To revert back to Classic mode authentication (disabled Claims Based Authentication) just change the 1 to a 0:
$setcba = Get-SPWebApplication "http://YourSiteURL" $setcba.UseClaimsAuthentication = 0; $setcba.Update() |
Thanks!
I thought you could not convert from claims to classic mode?
If you do that then assign to a new object like this:
$checkcba = get-spwebapplication “http://yoursiteurl”
$checkcba.UseClaimsAuthentication
I think it still returns 1
Hi,
I had a complete site running claims until someone tried to switch it to classic.
I have trouble getting the site back up. The site works, but some services are damaged beyond repair.
I cannot get the managed metadata working again .. .
Any tips?
Hi,
i’m experiencing errors after migrating to claims-based authentication. i get error event id 1309. cannot find user.
any ideas?
thanks for the short and efficient recipe
I have a web app running on claims based authentication and tried to convert it to classic mode.
But after running these commands no user could log in.
check here:
http://sharepointegg.blogspot.ru/2011/01/reverting-claim-based-authentication-to.html