I am running few powershell commands to configure server to server authentication for Federated Search.

I am following this URL - https://technet.microsoft.com/en-us/library/dn197169.aspx

While running following commands, I am getting error

Register-SPAppPrincipal -site $site.rootweb -nameIdentifier $sponameidentifier -displayName "SharePoint Online"


Get-SPAppPrincipal -site $site.rootweb -nameIdentifier $sponameidentifier

Error is -

Get-SPAppPrincipal : We're sorry, we weren't able to complete the operation, please try again in a few minutes. If you
see this message repeatedly, contact your administrator.
At line:1 char:1

+ Get-SPAppPrincipal -site $site.rootweb -nameIdentifier $sponameidentifier
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (Microsoft.Share...GetAppPrincipal:SPCmdletGetAppPrincipal) [Get-SPAppPrinc
   ipal], SPException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletGetAppPrincipal

I was not facing this problem when running same commands in a different SharePoint server. Any idea what can be the reason?


Finally after lot of research and digging through ULS logs, I found the solution for this question. I had created App Management Service Proxy earlier in the day on this new SharePoint server. When we create App Manager Service Proxy, it creates its own database which generally starts with name 'App_Managament_'.

This database name can be found by going to Central Admin --> Backup & Restore --> Shared Services --> App Management Service Application.

My login id did not had permissions on this database. Once permission was granted, I was able to query this database via PowerShell commands and both my commands started working fine.

Hope it helps someone who is facing the same problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.