Monsieur Winner

MS D365FO || Monsieur D365FO

On-premisesTechnical

Restore a failed deployment to initial state on LCS : D365FO On-premises

Dynamics d365FO on premises deployment is solely managed by the customer or client. The infrastructure is linked to LCS via the local agent. During deployment of custom or Microsoft packages, there could be error that might stop the environment(URL) from being accessible. Rolling back should take the environment back to its initial state before the package deployment. In some cases, that is not the case, as rollback keeps failing 🙄. Finding the major reason for the failure sometimes can take a while.

 

Not to worry, while the reason of the failure is being found, we can rollback using sql scripts.

The deployment status is captured in a the OrchestratorData database. Let’s roll back with the following steps:

 

1. Get the recent successful deployment state.

select * from OrchestratorJob order by LastProcessedDateTime desc
select * from RunBookTask order by StartDateTime desc

In the RunBookTask table, we are looking at the executePostDeploymentScript state in the name field; pick the corresponding RunbookTaskId as shown in the screenshot above.

Also get the the corresponding JobId in the OrchestratorJob table.

2. Revert to the recent successful deployment state.

update OrchestratorJob set state = 1 where jobid = 'XXXXUSUAT-a28c1aae-e84e-490d-b9dd-a928be71a774';
update RunBookTask set state = 1, Retries = 1 where RunbookTaskId = 'XXXUSUAT-a28c1aae-e84e-490d-b9dd-a928be71a774-executePostDeploymentScript';

hhhh

Once completed, your environment status should be deployed on LCS.

Komi Siabi

Komi Siabi is a Bilingual D365FO Solution architect who loves sharing his knowledge as he works on Both Francophone and Anglophone projects around the globe. He enjoys doing some tiktok videos in his leisure time.

Leave a Reply

Your email address will not be published. Required fields are marked *