Saturday, April 4, 2015

Migrating from AD to ADFS Sharepoint 2013 azure.

One of the problem we face when migrating to SharePoint 2013 azure is user migration as SP 2013 supports only Claim based authentication. So if your source SharePoint site is running on classic authentication, migrated users will not be able to login on 2013.
Another thing to consider would be that when we will migrate to Azure you domain will also change. On source it would be AD and on azure authentication provider would be ADFS.

But Microsoft has provided a solution to it. All you will have to do is to run Move-SPUser Command as mentioned here. Below mentioned power-shell script will convert all users of a site collection.

add-pssnapin microsoft.sharepoint.powershell
$url ="<Site Collection URL>"
#i:05.t|Domain-id-provider|username@domain.com
# get all users in the site, this includes iwindows users
$users = get-spuser -web $url -Limit ALL 
foreach($useriteration in $users)
{
     $a=@()
     $userlogin = $useriteration.UserLogin
    # get the user login name
    #Write-Host $userlogin
    if($userlogin.Contains("Domain\"))
                {
          $user = Get-SPUser -web $url -Identity $userlogin
          #Write-Host $user.Email
                  $userLoginInfo=$user.Email
                                if($userLoginInfo)
                                {
        #Write-Host $userlogin " = " $userLoginInfo
       Move-SPUser -IgnoreSID -Confirm:$false -Identity $user -NewAlias "i:05.t|domain-id-provider|$userLoginInfo"
                                                echo "User converted to claim with i:05.t|domain-id-provider|$userLoginInfo"
                        }
                                else
                                {
                                                echo "No email address map with user $userlogin"
                                }
                }
                else
                {
                                #echo "Non Domain user remains same $userlogin"
                }

}
Remove-pssnapin microsoft.sharepoint.powershell

No comments:

Post a Comment