In the previous posts, we saw that how to make ADFS as an Authentication Provider for our SharePoint 2013 WebApplication. But later, I faced an issue that, the Certificate which we are exporting from the ADFS Server and Creating an IssuerID and TrustedIdentityTokenIssuer cannot be changed for other WebApplications. I.e., We cannot create more than one TrustedIdentityTokenIssuer on the SharePoint Environment using the Same Certificate from the ADFS Server. At this point, there is no other option, I could find, how can I export a second certificate from the ADFS Server.
Hence, in the meanwhile, I came to a conclusion that, use the Existing TrustedIdentityTokenIssuer for the new WebApplication also. At that time, if you could see, the script to create the TrustedIdentityTokenIssuer is as follows.
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
#Import a token signing certificate by using Windows PowerShell
$root = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2("C:CertsSathishADFSCert.cer")
New-SPTrustedRootAuthority -Name "Sathish Seven Token Signing Cert Parent" -Certificate $root
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2("C:CertsSathishADFSCert.cer ")
New-SPTrustedRootAuthority -Name "Sathish Seven Token Signing Cert" -Certificate $cert
$realm = "urn:sharepoint:MyWebApplicationURL"
$signInURL = "https://MyADFSServerURL/adfs/ls"
#create an identity claim(email) mapping
$map = New-SPClaimTypeMapping -IncomingClaimType "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" -IncomingClaimTypeDisplayName "EmailAddress" -SameAsIncoming
#create an identity claim(UPN) mapping
$upnClaimMap = New-SPClaimTypeMapping -IncomingClaimType "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn" -IncomingClaimTypeDisplayName "UPN" -SameAsIncoming
#create an identity claim(Role) mapping
$RoleClaimmap = New-SPClaimTypeMapping -IncomingClaimType "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" -IncomingClaimTypeDisplayName "Role" –SameAsIncoming
#creating a Trustedidentity Token Issuer
#$ap = New-SPTrustedIdentityTokenIssuer -Name “Sathish Five Claims Provider” -Description “Sathish Identity Token Issuer” -realm $realm -ImportTrustCertificate $cert -ClaimsMappings $map,$upnClaimMap,$RoleClaimmap -SignInUrl $signInURL -IdentifierClaim $map.InputClaimType
Here the Parameter realm is attached with a particular WebApplication. What we need to do is, Add our new WebApplication URL too as a ProviderRealm. Basically, the ProviderRealm is a Set of URL Collection. There we can add more than one WebApplication URL. The pattern should “urn:sharePoint:WebApplicationURL”. The PowerShell Script to achieve this is
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$sts = Get-SPTrustedIdentityTokenIssuer | where {$_.Name -eq " Sathish Five Claims Provider "}
$uri = new-object System.Uri("https://MyNewWEbApplicationURL")
$uri
$sts.ProviderRealms.Add($uri, "urn:sharepoint:MyNewWebApplicationURL")
$sts.Update();
$sts
To Consolidate the above steps,
1. To make a WebApplication as a ADFS Authenticated one, we need a https enabled WebApplication. We discussed about that in this article.
2. Add the WebApplication to the RelyingParty Trust on the ADFS Server. We discussed about that in this article and here.
3. Add the WebApplicationURL to the ProviderRealms Collection of the TrustedIdentityTokenIssuer object.
4. Update and do an IISReset of the SharePoint Server. (All the front ends).
5. Change the Authentication Providers of the WEbApplication on the CentralAdministration to Claims Aware and Select the corresponding TrustedIdentityTokenIssuer.
6. Try logging in to the New WebApplication.
That’s it. We are done. Thus, we can add any number of web applications to a single TrustedIdentityTokenIssuer.
Happy Coding.
Sathish Nadarajan.
Leave a comment