Posts Tagged ‘Cannot validate argument on parameter ‘App principal’. The argument is null’
Setup Shared mailbox in Sharpoint 2013 to Exchange 2013 Oauth
When run the ./Set-SiteMailboxConfig.ps1 -ExchangeSiteMailboxDomain ‘domain name’ -WebApplicationUrl ‘SiteURL’
It gives 2 errors:
1) App management shared service proxy is not installed
(it was installed so this was not the actual error)
2) Cannot validate argument on parameter ‘App principal’. The argument is null. Supply a non-null argument and try the command again.
Error 2 was something interesting so we started to troubleshoot second error. Run powershell command Get-SPTrustedSecurityTokenIssuer
Realized there were 3 in the list and 1 of them was having NameID as null. Other STSs were from WorkFlow Manager.
Deleted all STSs with this command (note, all other services which use the STS will be affected if u do this. in my case i have to re register the WF manager)
Get-SPTrustedSecurityTokenIssuer | Remove-SPTrustedSecurityTokenIssuer –Confirm:$True
After that we run below commands to get a new STS and make sure the name id is not null
$exchange=Get-SPTrustedSecurityTokenIssuer
$app=Get-SPAppPrincipal -Site ‘web app URL’ -NameIdentifier $exchange.NameId
$site=Get-SPSite ‘root site URL’
Set-SPAppPrincipalPermission -AppPrincipal $app -Site $site.RootWeb -Scope sitesubscription -Right fullcontrol -EnableAppOnlyPolicy
Now when we run the set script again it works fine but when try to use the mailbox in SharePoint got error code 10 instead of error code0.
Asked the exchange team to run the oAuth command for this SharePoint Web Application Again.
Wait for a couple of hours so that it gets replicated on both nodes of the exchange farm.
3) Also check if the App Management Proxy is added to your specific Web Application by going to Central Administration -> Manage Web Application -> Select your Web Application.
In the ribbon, click “Service connections”. Make sure the “App Management Service Application Proxy” is selected for your Web Application. If it’s not, add it to the proxy group.
Now when i try to use the Site MailBox…it works!!!