I've imported a managed solution containing two web hook definitions (and many other things) into a sandbox environment. Today I've tried to import an update to that solution. The imported solution is shown as "..._Upgrade". When trying to apply the upgrade or deleting the "..._Upgrade"-solution I got the error "AuthValue is Invalid. Please check the value and format and retry the operation.".
The original exception from the downloaded error details is:
Microsoft.Crm.CrmArgumentException: AuthValue is Invalid. Please check the value and format and retry the operation.
---> Microsoft.Crm.CrmArgumentException: AuthValue is Invalid. Please check the value and format and retry the operation.
---> System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.LoadXml(String xml)
at Microsoft.Crm.ObjectModel.ServiceEndpointService.ValidateKeyValuePairs(String input)
--- End of inner exception stack trace ---
at Microsoft.Crm.ObjectModel.ServiceEndpointService.ValidateKeyValuePairs(String input)
at Microsoft.Crm.ObjectModel.ServiceEndpointService.VerifyWebhookAuthentication(IBusinessEntity entity)
at Microsoft.Crm.ObjectModel.ServiceEndpointService.VerifyWebhookData(IBusinessEntity entity, ExecutionContext context)
at Microsoft.Crm.ObjectModel.ServiceEndpointService.Update(IBusinessEntity entity, ExecutionContext context)
at Microsoft.Crm.ObjectModel.SolutionComponentUninstaller.Uninstall(ComponentTypeMapData componentTypeData, Guid componentObjectId, SolutionUninstallContext solutionUninstallContext)
at Microsoft.Crm.ObjectModel.TypeUninstallHandler.<>c__DisplayClass7_0.<UninstallComponent>b__0()
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action, IEnumerable`1 additionalCustomProperties)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)
at Microsoft.Crm.ObjectModel.TypeUninstallHandler.Uninstall(SolutionUninstallContext solutionUninstallContext)
at Microsoft.Crm.ObjectModel.SolutionUninstallService.Uninstall(ISolution solution, DynamicMetadataCache cache, ExecutionContext context)
at Microsoft.Crm.ObjectModel.SolutionServiceInternal`1.DeleteInternal(ISolution solution, ExecutionContext context)
at Microsoft.Crm.ObjectModel.SolutionServiceInternal`1.<>c__DisplayClass12_1.<DeleteAndUpdate>b__1()
at Microsoft.Crm.ObjectModel.CustomizationSqlLockManager.InternalAcquireOrExecuteInLock(CustomizationLockType customizationType, CrmException exceptionToThrow, Action action)
at Microsoft.Crm.ObjectModel.SolutionServiceInternal`1.DeleteAndUpdate(BusinessEntityMoniker moniker, ExecutionContext context, IBusinessEntity upgradingSolution)
at Microsoft.Crm.ObjectModel.SolutionServiceInternal`1.DeleteAndPromote(String parentUniqueName, ExecutionContext context)
--- End of inner exception stack trace ---
at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.Pipeline.<>c__DisplayClass3_0.<RunStep>b__0()
Solution:
Use the "PlugIn Registration Tool" to switch the web hooks inside the target environment from "WebHookKey" to "HttpQueryString" and add a property "code" with the function key (and renew function key until you don't have a "/" or "+" inside the string). After that change I was able to apply the upgrade.