Created
December 20, 2014 11:07
-
-
Save andrewconnell/f5a29e753ea2e414eada to your computer and use it in GitHub Desktop.
SharePoint Hosted Apps S2S - Create Trusted Security Token Issuer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-PSSnapin "Microsoft.SharePoint.PowerShell" | |
$issuerID = "11111111-1111-1111-1111-111111111111" | |
$targetSiteUrl = "http://wingtipserver" | |
$targetSite = Get-SPSite $targetSiteUrl | |
$realm = Get-SPAuthenticationRealm -ServiceContext $targetSite | |
$registeredIssuerName = $issuerID + '@' + $realm | |
Write-Host $registeredIssuerName | |
$publicCertificatePath = "C:\Certs\appserver.wingtip.com.cer" | |
$publicCertificate = Get-PfxCertificate $publicCertificatePath | |
Write-Host "Create token issuer" | |
$secureTokenIssuer = New-SPTrustedSecurityTokenIssuer ` | |
-Name $issuerID ` | |
-RegisteredIssuerName $registeredIssuerName ` | |
-Certificate $publicCertificate ` | |
-IsTrustBroker | |
$secureTokenIssuer | select * | |
$secureTokenIssuer | select * | Out-File -FilePath "SecureTokenIssuer.txt" | |
$serviceConfig = Get-SPSecurityTokenServiceConfig | |
$serviceConfig.AllowOAuthOverHttp = $true | |
$serviceConfig.Update() | |
Write-Host "All done..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment