Register Certificate as Trusted Token Issuer SharePoint 2013

When in need to register a certificate to SharePoint Trusted Token Issuer execute below powershell command in SharePoint Management Shell.
$issuerID = "SomeGuid"
$targetSiteUrl = "http://XXX:YYYY/sites/SiteName"
$targetSite = Get-SPSite $targetSiteUrl
$realm = Get-SPAuthenticationRealm -ServiceContext $targetSite
$registeredIssuerName = $issuerID + '@' + $realm
$publicCertificatePath = "C:\certs\XXX.cer"
$publicCertificate = Get-PfxCertificate $publicCertificatePath
Write-Host "Create Security token issuer"
$secureTokenIssuer = New-SPTrustedSecurityTokenIssuer -Name $issuerID -RegisteredIssuerName $registeredIssuerName -Certificate $publicCertificate -IsTrustBroker
$secureTokenIssuer | select *
$secureTokenIssuer | select * | Out-File -FilePath "SecureTokenIssuer.txt"


In case existing ones needed to be deleted then use below script to delete all.
Get-SPTrustedSecurityTokenIssuer | ForEach-Object {Remove-SPTrustedSecurityTokenIssuer -Identity $_.Id.ToString() }

Comments

Popular posts from this blog

Install Node.js without admin rights

Session Storage Methods with Expiry

Create a lean React Solution using Typescript