Hello everybody,
We have a farm with several site subscriptions.
Each subscription should use single high-trust app on it's dedicated site collection.
There is no problem when we provide app for only one site subscription. Then we use site subscription realm for registering Trusted Security Token Issuer and for permissions applying.
$spUrl = "https://samarbetsrum-ind.testtenant.se"
$authorityName = "apps trust tenant1"
$spWeb = Get-SPWeb $spUrl
$realm = Get-SPAuthenticationRealm -ServiceContext $spWeb.Site
$certificate = Get-PfxCertificate $publicCertificatePath
New-SPTrustedRootAuthority -Name $authorityName -Certificate $certificate
$fullIssuerIdentifier = $issuerId + '@'+ $realm
New-SPTrustedSecurityTokenIssuer -Name $issuerId -Certificate $certificate -RegisteredIssuerName $fullIssuerIdentifier –IsTrustBroker
$nameIdentifier = $clientId + "@" + $realm
$appPrincipal = Register-SPAppPrincipal -site $web -NameIdentifier $nameIdentifier -DisplayName $fullAppName
Set-SPAppPrincipalPermission -appPrincipal $appPrincipal -site $web -scope SiteSubscription -Right "Read"
So when we play with one tenant, everything is just fine.
Problems appear only when we start to configure several site subscriptions.
We have been trying 2 approaches:
1. register single Trusted Security Token Issuer. If we do so, user gets 401 error when exploring provider-hosted app page. Probably, it is because we registered farm realm and each site subscription has it's own different realm.
2. register dedicated Trusted Security Token Issuer for each tenant. In this case we get error in PowerShell
New-SPTrustedSecurityTokenIssuer : Exception of type 'System.ArgumentException' was thrown.
Parameter name: newObj
At line:1 char:1
+ New-SPTrustedSecurityTokenIssuer -Name $issuerId -Certificate $certificate -Regi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Share...rityTokenIssuer:SPCmdletNewTrustedSecurityTokenIssuer) [New-SPTrustedSecurityTokenIssu
er], ArgumentException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewTrustedSecurityTokenIssuer
The only way we found to avoid this problem is generating different issuer id for each tenant.
Please share your ideas.
Should we use dedicated issuer id for each tenants? Then it will be extremely inconvenient, I guess.