Fixing apps after configuring SharePoint hybrid features
Summary: This article provides a solution to broken provider-hosted add-ins after configuring SharePoint hybrid features.
For a full list of hybrid features, see the following article: http://www.sharepointrelated.com/2016/10/04/hybrid-features-sharepoint-2013-and-2016
When you configure hybrid for SharePoint 2013 / SharePoint 2016, your existing server-to-server trusts will stop working.
The following hybrid features will break your server-to-server trusts that were already set up before configuring hybrid for SharePoint 2013 or SharePoint 2016:
- Cloud Hybrid Search
- Extensible App Launcher
- Hybrid sites
- Hybrid taxonomy
- Hybrid Auditing
This post will describe why this happens and how we can fix this.
In order to establish a server-to-server trust between your on-premises SharePoint environment and Office 365, Microsoft relies on the SPAuthenticationRealm. More information can be found here: https://technet.microsoft.com/en-us/library/jj219756.aspx.
This article has a "Caution" section, warning that any access tokens created for a specific realm, won't work after changing the SPAuthenticationRealm. http://www.sharepointrelated.com/wp-content/uploads/2016/08/caution.png
To fix this, I wrote a script that gives you 2 options:
**- Undo
**Reverse the changes made by configuring Hybrid. It will change the SPAuthenticationRealm back to the old value. All SharePoint hybrid features stop working. All your provider-hosted add-ins will work again.
- Fix
This option will try to change your SPTrustedSecurityTokenIssuers so that it uses the new SPAuthenticationRealm set by configuring hybrid.
http://www.sharepointrelated.com/wp-content/uploads/2016/08/cautionflag.gifThere are some notes that I described later in this post\, make sure to read them.[/table] Running the script will result in something like this: |
http://www.sharepointrelated.com/wp-content/uploads/2016/08/Fix-Onboarding-script.png
Running the Fix-Hybrid.ps1 script
You can download the script here:
http://www.sharepointrelated.com/wp-content/uploads/2016/08/Fix-Hybrid.png
Notes
If you choose to fix your SPTrustedSecurityTokenIssuers, you will need to do some additional work to have everything work again.
- Regrant app permissions
App permissions rely on the SPAuthenticationRealm. This means that any App permissions that you set, will be gone after updating your SPTrustedSecurityTokenIssuers. You will have to register the apps again and assign the permissions to the app. The following script can do this for you (the current script is app-instance based, this means you have to run it for every app instance. Also, make sure to change the variables in the script before running it.
http://www.sharepointrelated.com/wp-content/uploads/2016/08/Set-SPAppPermissions.png
- Workflow Manager
Workflow Manager also relies on the SPAuthenticationRealm. Thanks to Ruben de Boer for proposing the solution. After running the Fix-Onboarding.ps1 script, make sure to remove the existing Workflow Service Application Proxy. Then run the Register-SPWorkflowService cmdlet again. Make sure to use the same scope that you used before. I recommend using the -Force parameter.
I hope this helps anyone! Do not hesitate to contact me if you have any trouble using the script of have any questions.