After replacement/rebuild of SharePoint farm and re-deploying K2 for SharePoint app registration wizard fails on SharePoint Service Broker step with the following error:
Unable to retrieve realm for SharePoint site: https://%APP_ID%.domain.com/sites/appcatalog/K2forSharePoint
APP_ID in error message refers to the APP_ID relevant for old/decommissioned SharePoint farm and does not match one you will see in address bar.
References to the old app ID have are not removed from K2 database.
References to the old app ID have to be removed from K2 database. To resolve this you need to delete them from [Integration].[ProcessSharePointGeneralSetting] table as explained below:
- Backup your K2 database
- Execute the following SQL query against K2 database:
DELETE FROM [Integration].[ProcessSharePointGeneralSetting] WHERE SiteURL = -- Type in url from error message in single quotes below'https://%APP_ID%.domain.com/sites/appcatalog/K2forSharePoint'
- Restart K2 service and run K2 for SharePoint app registration wizard against