SharePoint SAML Migration Guide – Part 3 Migration

SharePoint SAML Migration Guide – Part 1 Planning

SharePoint SAML Migration Guide – Part 2 Trusted Identity

SharePoint SAML Migration Guide – Part 3 Migration

SharePoint SAML Migration Guide – Part 4 Web Applications

SharePoint SAML Migration Guide – Part 5 User Profiles

Now that we have our Identity provider built we can move on to Migration. There are some misconceptions about SAML users and Windows users. There are a few blog posts out there(including mine) explaining why we need to migrate.

Depending on how the trusted provider was built in step 2 will determine the way we will migrate the users. The two options are to use Move-SPUser or Convert-SPWebApplication.

Move-SPUser

Move-SPUser has been around since the 2010 version shipped and is the same as stsadm migrateuser command. This can be used to migrate users or groups. Running Move-SPUser is a farm wide migration. This means, all web applications, user profiles, etc. will be migrated. There are many scripts out there that we get the users and groups from the site collections which then migrates them to the SAML claims.

$user = Get-SPUser -Identity "i:o#.w|contoso\user1" -Web https://contoso"
Move-SPUser -Identity $user -NewAlias "i:05.t|SAML|admin@contoso.com"

This process can take some time to complete for migrating users depending on how many users and how many site collections are in the farm.

Convert-SPWebApplication

This method is only available for Trusted Providers that are created with -UseDefaultConfiguration. This will migrate users and groups to use SAML only within the web application that is run against this. Unlike Move-SPUser this will only affect the web application that is specified. Check out my ADFS guide here

 
$wa = Get-SPWebApplication https://contoso 
$ap = Get-SPTrustedIdentityTokenIssuer "SAML" Convert-SPWebApplication -Identity 
$wa -From CLAIMS-WINDOWS -To CLAIMS-TRUSTED-DEFAULT -TrustedProvider $ap -RetainPermissions 

Note: If a user does not have an identifier claim in AD(like a missing email), that user is not migrated. This will show up in the ULS logs and the UserInfo table of the content databases.

After we migrated the users and groups we need to shut down the Windows Authentication so we do not have the users log in with the Windows accounts. This would cause them to receive access denied and many other undesirable behaviors.

Resources

Move-SPUser
https://docs.microsoft.com/en-us/powershell/module/sharepoint-server/move-spuser?view=sharepoint-ps

Convert-SPWebApplication
https://docs.microsoft.com/en-us/powershell/module/sharepoint-server/convert-spwebapplication?view=sharepoint-ps

Permissions

If we don’t have any users to migrate or just want to test accessing sites, we would need to add in the user to user policy at the web application level. This spot is the easiest way to look at the claim we are adding while giving permission to a test account.


We can see the user first ‘User1’ is the ADFS claim and the second is the Windows claims.

SharePoint SAML Migration Guide – Part 2 Trusted Identity

SharePoint SAML Migration Guide – Part 1 Planning

SharePoint SAML Migration Guide – Part 2 Trusted Identity

SharePoint SAML Migration Guide – Part 3 Migration

SharePoint SAML Migration Guide – Part 4 Web Applications

SharePoint SAML Migration Guide – Part 5 User Profiles

Part 2 – Trusted Identity

The Trusted Identity Provider has two main options which will assist with the claim provider.

-UseDefaultConfiguration

This will provision an out of the box claim provider that will behave similar to the Windows Authentication’s claim provider.

The script below is to create the trusted provider with -UseDefaultConfiguration. Make the modifications to match your environment. More information on setup and mapping in ADFS check out my ADFS Migration post here.

 
$name = "ADFS" $description = "Description of Token Issuer" 
$signinURL = "https://adfs.contoso.com/adfs/ls" 
$realm = "urn:sp13:contoso" 
$adfscertPath = "C:\adfscert.cer" 
$IDClaim = "EMAIL" #Choose between ACCOUNT-NAME, EMAIL, OR USER-PRINCIPAL-NAME 
$adfscert = New-Object System.Security.Cryptography.X509Certificates.X509Certificates2($adfscertPath) 
New-SPTrustedIdentityTokenIssuer -Name $name -Description $description -realm $realm -ImportTrustCertificate $ADFSCert -SignInUrl $signinURL -UseDefaultConfiguration -IdentifierClaimIs $IDClaim 

NOTE: This method is not compatible with custom claim providers like LDAPCP due to the systemID being a SID claim instead of the identifier claim.

The other choice is without the -UseDefaultConfiguration. We would use this method if we are wanting to use a 3rd party claim provider or the SAML provider is unable to pass Group tokens as SIDs. This will require us to map the identity claim and other claim(s), if required. This does not come with a claims provider so we will need a customer claim provider such has LDAPCP.

 
#claim mappings 
$email = New-SPClaimTypeMapping -IncomingClaimType "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" -IncomingClaimTypeDisplayName "EmailAddress" –SameAsIncoming 
$upn = New-SPClaimTypeMapping -IncomingClaimType "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn" -IncomingClaimTypeDisplayName "UPN" –SameAsIncoming 
$Role = New-SPClaimTypeMapping -IncomingClaimType "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" -IncomingClaimTypeDisplayName "Role" –SameAsIncoming 
$name = "ADFS" $description = "Description of Token Issuer" 
$signinURL = "https://adfs.contoso.com/adfs/ls" 
$realm = "urn:sp13:contoso" 
$adfscertPath = "C:\adfscert.cer" 
New-SPTrustedIdentityTokenIssuer -Name $name -Description $description -Realm $realm -ClaimsMappings $upn,$email,$role -SignInUrl $signinURL -IdentifierClaim $email.InputClaimType 

After we have the Trusted Identity Token Issuer created, we can move on to Part 3 – Migration.

Resources:

New-SPTrustedIdentityTokenIssuer – https://docs.microsoft.com/en-us/powershell/module/sharepoint-server/new-sptrustedidentitytokenissuer?view=sharepoint-ps

Plan for user authentication methods in SharePoint Server – https://docs.microsoft.com/en-us/SharePoint/security-for-sharepoint-server/plan-user-authentication

SharePoint SAML Migration Guide – Part 1 Planning

SharePoint SAML Migration Guide – Part 1 Planning

SharePoint SAML Migration Guide – Part 2 Trusted Identity

SharePoint SAML Migration Guide – Part 3 Migration

SharePoint SAML Migration Guide – Part 4 Web Applications

SharePoint SAML Migration Guide – Part 5 User Profiles

Part 1 – Planning

With most everything in SharePoint, planning and testing is key before slamming it into production. We will need to review some high-level concepts of SharePoint to help determine which patch works for your organization.

Clam Providers – This is the same as people picker. With Windows Authentication, there is an Active Directory (AD) Claim Provider which will send LDAP queries to AD. SAML authentication does not come with a claim provider unless we use -UseDefaultConfiguration.

Trusted Identity Provider – This is created in SharePoint to hook up the SAML provider. This may redirect to SAML providers like ADFS or other 3rd party providers. SharePoint’s PowerShell commandlet to display them is Get-SPTrustedIdentityTokenIssuer
Identity Claim – This is claim that will uniquely identify a user. This is usually Email, UPN, or sAMAccountName.

Migrating from Windows Claims to SAML Claims requires to know the different paths and choices we can make. We can migrate the users and groups using Move-SPUser or Convert-SPWebApplication (only available when using -UseDefaultConfiguration).

Choosing an Identity Claim

The identity claim is unique to the user and must be passed in the SAML token from the SAML provider. As stated above, this could be Email, sAMAccountName, UPN, or something different. The value should be unique for that user and no other users would have this value or we’re going to have trouble down the road with user profiles, permissions, migration, etc. Note: Currently the Convert-SPWebApplication does not work with UPN. This will be important to user profiles when they are imported.

Type

Windows Claim

ID

SAML Claim

User

i:0#.w|contoso\administrator

sAMAccountName

i:0#.t|SAML|administrator

Email

i:05.t|SAML|admin@contoso.com

UPN

i:0e.t|SAML|administrator@contoso.com
Group

c:0+.w|s-1-5-21-3687283648-2425067875-2523671615-101068

UseDefaultConfiguration

c:0+.t|SAML|s-1-5-21-3687283648-2425067875-2523671615-101068

Without UseDefaultConfiguation

c:0-.t|SAML|Group1 (unqualified)
c:0-.t|SAML|contoso\Group1 (qualified)
c:0-.t|SAML|contoso.com\Group1 (fully qualified)

SharePoint 2016/2019 MIM not updating Multivalue Properties

User profiles that are syncing Multivalued properties with BDC, AD, etc. will not be pulled into the SPMA(SharePoint Management Agent) during the Delta Import step after modification or deletion of the values.

 

 

Under the Hood

The first step is to step Fiddler to capture the MIM server sending the request to Central Admin. This can be done by modifying the C:\Program Files\Microsoft Forefront Identity Manager\2010\Synchronization Service\Bin\miiserver.exe.config. Please make a backup of this file before modifying this. The following XML will need to put in before the </configuration>.

<system.net>

<defaultProxy>

<proxy autoDetect=”false” bypassonlocal=”false” proxyaddress=”http://127.0.0.1:8888″ usesystemdefault=”false” />

</defaultProxy>

</system.net>

</configuration>

 

The IP address will be the server where fiddler is running. I have it running on the same server that MIM is running. After this is done, we need to reset Forefront Identity Manager Synchronization Service in services.msc.

Fiddler showed us that we’re not asking for any multivalued/termset properties which is why we didn’t update the connector space with any change. SharePoint returns with no results.

 

Modifying the SPMA

The SPMA controls the attributes that we are asking SharePoint for since that’s the only connection to SharePoint for MIM. We would need to go into the MIM client à Management Agents à Properties for SPMA à Connectivity

Check the box for Import auto-updated attributes and the password for the account. Click OK and kick off a full.

After reproducing (deleting out the value for a user in the User Profile Service Applciation) the issue we’re seeing the DeltaImport with 1 Update.

Fiddler shows MIM asking for those properties and SharePoint sending that update.

 

 

Don’t forget to remove the Fiddler/proxy entry in the miiserver.exe.config and bounce the service (if you decided to put that in).

SharePoint – Access Denied Federation Module

Getting accessdenied.aspx for all users can be very frustrating. Usually it’s an issue with the Super User/Super Reader configuration issue (see https://joshroark.com/sharepoint-the-complete-guide-to-portalsuperuseraccount-and-portalsuperreaderaccount/).

To the Logs

The ULS logs are the key to finding out why we’re getting redirected. We want to get the Correlation ID of the page that is going to be redirecting the client to accessdenied.aspx. A fiddler trace is a helpful tool to find the correct correlation ID.

The ULS logs for the request will show that we’re failing on the Federation Module.

02/15/2019 12:39:42.99    w3wp.exe (0x1BAC)    0x4170    SharePoint Foundation    Security    8gs1    Verbose    Access Denied for /. StackTrace:   
 at Microsoft.SharePoint.Utilities.SPUtility.HandleAccessDenied(HttpContext context)    
 at Microsoft.SharePoint.IdentityModel.SPFederationAuthenticationModule.OnEndRequest(Object sender, EventArgs eventArgs)    
 at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()    
 at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)    
 at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)    
 at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)    
 at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)    
 at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
 at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
 at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)    
 at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)    
 at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)

This is usually due to the Everyone group removed from “Bypass traverse checking”. Local Security Policy à Local Policies à User Rights Assignments à Bypass traverse checking

Add in the Everyone and Users group if they are missing, IISReset, and we’re able to access the site again.