Saturday, April 21, 2018

Generate App ID for Provider Hosted App in SharePoinr 2013 [ powershell script]

$site ="http://win12sp13:40/sites/km"
$appname="Provider Hosted App Sample"
$appId =[System.Guid]::NewGuid().toString()
$certPath= "E:\SPH-Certificate.cer"
$web=Get-SPweb $site
$realm=Get-SPAuthenticationRealm -ServiceContext $web.Site
$appCertificate=Get-PfxCertificate $certPath
$fullAppId=$appId + '@' + $realm

$sti =new-SPTrustedSecurityTokenIsuuer -Name $appname -Certificate $appCertificate -
RegisteredIssuerName $fullAppId

$principal=Register-SPAppPrincipal -NameIdentifier $fullAppId -Site $web -DisplayName $appname

$sts=Get-SPSecurityTokenServiceConfig
$sts.AllowoauthoverHttp=$true
$sts.Update()
$appId


No comments:

Post a Comment