dyn365-ce-vsts-tasks icon indicating copy to clipboard operation
dyn365-ce-vsts-tasks copied to clipboard

"Unable to deserialize the response." when backup online instance

Open epellegrom opened this issue 3 years ago • 6 comments

Hi,

For a couple of days, we experience an error when we execute the task: "MSCRM Backup Online Instance". We get the error: ##[error]Unable to deserialize the response.

Starting: Backup instance
==============================================================================
Task         : MSCRM Backup Online Instance
Description  : Creates a backup of a Dynamics 365 Customer Engagement Online Instance
Version      : 10.0.6
Author       : Wael Hamze
Help         : This task uses the Microsoft.Xrm.OnlineManagementAPI: https://www.powershellgallery.com/packages/Microsoft.Xrm.OnlineManagementAPI
==============================================================================
##[error]Unable to deserialize the response.
Finishing: Backup instance

This task is using the: https://www.powershellgallery.com/packages/Microsoft.Xrm.OnlineManagementAPI what I notice is that this library is also updated a couple of days ago, maybe it is related?

Many thanks already!

Regards, Erik

epellegrom avatar Nov 11 '20 16:11 epellegrom

@epellegrom

You can change the version of the OnlineManagementAPI to the latest version in the tool installer task and see if it will work?

WaelHamze avatar Nov 16 '20 19:11 WaelHamze

@waelhamze - significant changes to the OnlineManagementAPI nuget package have been made in preperation for legacy service decom. A couple of things that are relevant:

  • The legacy service (admin.service.*) endpoints are actually being turned off as we speak.
  • The PowerShell cmdlets in that nuget package were rewritten to leverage another set of cmdlets in the PowerApps Admin module.
  • Reviewing the implementation of this package it appears that it is leveraging Microsoft.Xrm.OnlineManagementAPI.dll which did NOT undergo any changes and hence will be broken by the decom effort. Would be happy to partner with you and discuss options as I believe may users will be impacted by this. Could I get you to contact the CrmSdk owners here? Is there another channel in which we could discuss best next steps? https://www.powershellgallery.com/packages/Microsoft.Xrm.OnlineManagementAPI/2.0.0.18/ContactOwners

bpevans avatar Nov 16 '20 21:11 bpevans

@bpevans I am aware of these changes.

Have you tried using the latest version of the OnlineManagement API in the tool installer task? This should still work while we change the implementation to use the latest APIs.

WaelHamze avatar Dec 01 '20 07:12 WaelHamze

I have also been unable to get "MSCRM Backup Online Instance" to work recently. I am getting a different error "Object reference not set to an instance of an object". I have tried using the latest version, but get the same error.

wfemichel avatar Jan 15 '21 18:01 wfemichel

I have the same issue as @wfemichel. Seems to be some sort of authentication issue. Not really sure what is causing this. I actually downloaded you ps1 scripts directly and called it locally. I got the same error. I'm sure the username and password are correct. They are directly copied from a password manager app and they work when logging into 'https://admin.powerplatform.microsoft.com'

2021-01-18T14:39:48.0185687Z ##[debug]Imported Online Management Module 2021-01-18T14:39:48.0799523Z ##[debug]Entering OnlineInstanceFunctions.ps1 2021-01-18T14:39:48.0827893Z ##[debug]Leaving OnlineInstanceFunctions.ps1 2021-01-18T14:39:48.0993209Z ##[debug]Connecting to API server: https://admin.services.crm4.dynamics.com/ 2021-01-18T14:39:48.1622660Z ##[debug]Entering GetCrmInstances - ProcessRecord 2021-01-18T14:39:48.1697420Z ##[debug]Executing GetCrmInstances 2021-01-18T14:39:48.2319227Z ##[debug]Requesting Authentication - Start 2021-01-18T14:39:48.2367921Z ##[debug]Requesting Authority From server - Start 2021-01-18T14:39:48.3158481Z ##[debug]Failed GetCrmInstances - ProcessRecord : 00:00:00.1499129 2021-01-18T14:39:48.3192613Z ##[debug] 2021-01-18T14:39:48.3435229Z ##[debug]Message: The pipeline has been stopped. 2021-01-18T14:39:48.3488340Z ##[debug]Source : System.Management.Automation 2021-01-18T14:39:48.3517806Z ##[debug]Method : _WriteErrorSkipAllowCheck 2021-01-18T14:39:48.3548318Z ##[debug]Date : 1/18/2021 2021-01-18T14:39:48.3602227Z ##[debug]Time : 2:39:48 PM 2021-01-18T14:39:48.3688102Z ##[debug]Error : The pipeline has been stopped. 2021-01-18T14:39:48.3720284Z ##[debug]Stack Trace : at System.Management.Automation.MshCommandRuntime._WriteErrorSkipAllowCheck(ErrorRecord errorRecord, Nullable1 actionPreference) 2021-01-18T14:39:48.3750066Z ##[debug] at System.Management.Automation.MshCommandRuntime.DoWriteError(Object obj) 2021-01-18T14:39:48.3778951Z ##[debug] at System.Security.SecurityContext.Run(SecurityContext securityContext, ContextCallback callback, Object state) 2021-01-18T14:39:48.3812239Z ##[debug] at System.Management.Automation.MshCommandRuntime.WriteError(ErrorRecord errorRecord, Boolean overrideInquire) 2021-01-18T14:39:48.3849265Z ##[debug] at System.Management.Automation.Cmdlet.WriteError(ErrorRecord errorRecord) 2021-01-18T14:39:48.3898581Z ##[debug] at Microsoft.Xrm.OnlineManagementAPI.Auth.AuthManager.ExecuteAuthenticateServiceProcess(PSCredential clientCredentials, X509Certificate2 userCert, UserIdentifier user, PromptBehavior promptBehavior, String tokenCachePath, Nullable1 TenantId) 2021-01-18T14:39:48.3929110Z ##[debug] at Microsoft.Xrm.OnlineManagementAPI.Auth.AuthManager.<GetToken>d__20.MoveNext() 2021-01-18T14:39:48.3956021Z ##[debug]--- End of stack trace from previous location where exception was thrown --- 2021-01-18T14:39:48.4014778Z ##[debug] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 2021-01-18T14:39:48.4072166Z ##[debug] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 2021-01-18T14:39:48.4100853Z ##[debug] at Microsoft.Xrm.OnlineManagementAPI.Auth.AuthManager.<GetAuthenticationHeaderAsync>d__29.MoveNext() 2021-01-18T14:39:48.4162658Z ##[debug]--- End of stack trace from previous location where exception was thrown --- 2021-01-18T14:39:48.4195134Z ##[debug] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 2021-01-18T14:39:48.4247895Z ##[debug] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 2021-01-18T14:39:48.4275444Z ##[debug] at Microsoft.Rest.TokenCredentials.<ProcessHttpRequestAsync>d__17.MoveNext() 2021-01-18T14:39:48.4329437Z ##[debug]--- End of stack trace from previous location where exception was thrown --- 2021-01-18T14:39:48.4346951Z ##[debug] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 2021-01-18T14:39:48.4373641Z ##[debug] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 2021-01-18T14:39:48.4401173Z ##[debug] at Microsoft.Xrm.Services.Admin.Client.D365CEAdminClient.<GetInstancesWithHttpMessagesAsync>d__32.MoveNext() 2021-01-18T14:39:48.4512434Z ##[debug]--- End of stack trace from previous location where exception was thrown --- 2021-01-18T14:39:48.4574771Z ##[debug] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 2021-01-18T14:39:48.4598116Z ##[debug] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 2021-01-18T14:39:48.4630248Z ##[debug] at Microsoft.Xrm.Services.Admin.Client.D365CEAdminClientExtensions.<GetInstancesAsync>d__11.MoveNext() 2021-01-18T14:39:48.4662182Z ##[debug]--- End of stack trace from previous location where exception was thrown --- 2021-01-18T14:39:48.4692388Z ##[debug] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 2021-01-18T14:39:48.4723926Z ##[debug] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 2021-01-18T14:39:48.4753416Z ##[debug] at Microsoft.Xrm.Services.Admin.Client.D365CEAdminClientExtensions.GetInstances(ID365CEAdminClient operations) 2021-01-18T14:39:48.4823995Z ##[debug] at Microsoft.Xrm.OnlineManagementAPI.GetCrmInstances.ProcessRecord() 2021-01-18T14:39:48.4851741Z ##[debug]====================================================================================================================== 2021-01-18T14:39:48.4878679Z ##[debug] 2021-01-18T14:39:48.5162148Z ##[debug]Caught exception from task script. 2021-01-18T14:39:48.5226124Z ##[debug]Error record: 2021-01-18T14:39:48.6450335Z ##[debug]Get-CrmInstances : Object reference not set to an instance of an object. 2021-01-18T14:39:48.6491175Z ##[debug]At C:\hostedtoolcache\windows\MSCRMBuildTools\12.0.37\xRMCIFramework\9.0.0\OnlineInstanceFunctions.ps1:14 char:15 2021-01-18T14:39:48.6519215Z ##[debug]+ $instances = Get-CrmInstances -ApiUrl $ApiUrl -Credential $Cred 2021-01-18T14:39:48.6550357Z ##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2021-01-18T14:39:48.6621907Z ##[debug] + CategoryInfo : PermissionDenied: (:) [Get-CrmInstances], NullReferenceException 2021-01-18T14:39:48.6652686Z ##[debug] + FullyQualifiedErrorId : ERROR REQUESTING Token FROM THE Authentication context,Microsoft.Xrm.OnlineManagementAPI .GetCrmInstances 2021-01-18T14:39:48.6695327Z ##[debug] 2021-01-18T14:39:48.6817463Z ##[debug]Script stack trace: 2021-01-18T14:39:48.6932543Z ##[debug]at Get-XrmInstanceByName, C:\hostedtoolcache\windows\MSCRMBuildTools\12.0.37\xRMCIFramework\9.0.0\OnlineInstanceFunctions.ps1: line 14 2021-01-18T14:39:48.6965825Z ##[debug]at <ScriptBlock>, C:\hostedtoolcache\windows\MSCRMBuildTools\12.0.37\xRMCIFramework\9.0.0\BackupOnlineInstance.ps1: line 60 2021-01-18T14:39:48.7036573Z ##[debug]at <ScriptBlock>, D:\a_tasks\MSCRMBackupOnlineInstance_0c3e661c-d316-443e-9a77-470989da8e29\12.0.5\MSCRMBackupOnlineInstance.ps1: line 38 2021-01-18T14:39:48.7071491Z ##[debug]at <ScriptBlock>, <No file>: line 1 2021-01-18T14:39:48.7109423Z ##[debug]at <ScriptBlock>, <No file>: line 22 2021-01-18T14:39:48.7142864Z ##[debug]at <ScriptBlock>, <No file>: line 18 2021-01-18T14:39:48.7171229Z ##[debug]at <ScriptBlock>, <No file>: line 1 2021-01-18T14:39:48.7209176Z ##[debug]Exception: 2021-01-18T14:39:48.7285081Z ##[debug]System.NullReferenceException: Object reference not set to an instance of an object. 2021-01-18T14:39:48.7358847Z ##[debug] at Microsoft.Xrm.OnlineManagementAPI.Auth.AuthManager.GetAuthorityFromTargetService(String targetServiceUrl) 2021-01-18T14:39:48.7393167Z ##[debug] at Microsoft.Xrm.OnlineManagementAPI.Auth.AuthManager.ExecuteAuthenticateServiceProcess(PSCredential clientCredentials, X509Certificate2 userCert, UserIdentifier user, PromptBehavior promptBehavior, String tokenCachePath, Nullable`1 TenantId) 2021-01-18T14:39:48.7844695Z ##[error]Object reference not set to an instance of an object. 2021-01-18T14:39:48.8223576Z ##[debug]Processed: ##vso[task.logissue type=error]Object reference not set to an instance of an object. 2021-01-18T14:39:48.8225313Z ##[debug]Processed: ##vso[task.complete result=Failed] 2021-01-18T14:39:48.8539909Z ##[section]Finishing: Backup instance

mVermaat avatar Jan 18 '21 16:01 mVermaat

The nuget packages being used in this system were recently updated. The public surface to that nuget package is the PowerShell cmdlets. In previous versions of the cmdlets they were dependent on the DLLs shipped in the nuget. All the cmdlets have been updated to rely on another mechanism as well as redirecting all calls to other power platform endpoints. However the legacy DLLs are still shipped in the nuget and are completely non-functional. This package needs to be re-written to not have dependencies on the DLLs shipped in the OnlineManagementAPI nuget since they no longer work.

bpevans avatar Jan 19 '21 22:01 bpevans