VALIDATION Index was outside the bounds of the array when registering CRM Service Instance
kbt141251
PRODUCTIssue
When attempting to register a CRM service instance via the K2 Management site, a "VALIDATION Index was outside the bounds of the array" error appears.
Symptoms
It was determined that K2 is integrated with AAD and only the "K2 Trust for Azure AD" issuer is enabled.
However CRM was on-premise.
When registering a CRM service instance, it will default to "Impersonate" as the Authentication Mode and as such will use the current user context (which is currently an AAD account).
It appears that Azure AD is not supported by CRM and it is likely expecting an Active Directory/domain credential:
https://community.dynamics.com/crm/f/117/t/163064
Resolution
Some options to register a CRM service instance includes:
1. Enable/keep the 'K2 Windows STS' issuer; as it will allow for usage of an Active Directory/domain user account to register the CRM service instance (if the "Impersonate" Authentication Mode is desired).
2. You may be able to register the CRM service instance using one of the other Authentication Modes (depending on the permissions):
Service Account
SSO
Static
3. Use the SmartObject Service Tester tool (C:Program FilesK2Bin) as it will use Integrated Windows Authentication/current domain account.